Project

General

Profile

Revision 561a8ac9

Added by Thomas McKay over 8 years ago

update roles use of api with test and docs

Note: The roles test does not work completely since changing user is not working. Unsure how to accomplish this. Tests run as admin do work.

View differences:

test/csv_test_helper.rb
25 25
require 'hammer_cli_foreman'
26 26
require 'hammer_cli_katello'
27 27

  
28
def ctx
29
  {
30
    :interactive => false,
31
    :username => 'admin',
32
    :password => 'changeme'
33
  }
28
module HammerCLIForeman
29
  def self.clear_credentials
30
    @credentials = nil
31
  end
34 32
end
35 33

  
34

  
36 35
def hammer(context=nil)
37
  HammerCLI::MainCommand.new("", context || ctx)
36
  HammerCLI::MainCommand.new("", context || HammerCLI::Settings.dump)
38 37
end
39 38

  
40 39
def capture
......
50 49
end
51 50

  
52 51
def set_user(username, password='changeme')
52
  HammerCLI::Connection.drop_all
53
  HammerCLIForeman.clear_credentials
53 54
  HammerCLI::Settings.load({
54
                             :_params => {
55
                               :username => username,
56
                               :password => password,
57
                               :interactive => false
58
                             }})
55
                               :_params => {
56
                                   :username => username,
57
                                   :password => password
58
                               },
59
                               :foreman => {
60
                                   :username => username,
61
                                   :password => password
62
                               },
63
                               :csv => {
64
                                   :username => username,
65
                                   :password => password
66
                               }
67
                           })
59 68
end
60 69

  
61 70

  

Also available in: Unified diff