Project

General

Profile

Revision bfc065ce

Added by Thomas McKay over 8 years ago

roles-test - wip

roles-test - users now get roles, orgs, and locations

View differences:

test/csv_test_helper.rb
15 15
require "mocha/setup"
16 16

  
17 17
require 'hammer_cli_csv'
18
require 'hammer_cli_katello'
19
require 'hammer_cli_foreman'
18 20

  
19
def ctx 
20
  { :adapter => :silent }
21
def ctx
22
  {
23
    :adapter => :csv,
24
    :interactive => false
25
  }
26
end
27

  
28
def hammer
29
  HammerCLI::MainCommand.new("", ctx)
30
end
31

  
32
def capture
33
  old_stdout = $stdout
34
  old_stderr = $stderr
35
  $stdout = stdout = StringIO.new
36
  $stderr = stderr = StringIO.new
37
  yield
38
  [stdout.string, stderr.string]
39
ensure
40
  $stdout = old_stdout
41
  $stderr = old_stderr
42
end
43

  
44
def set_user(username, password='changeme')
45
  HammerCLI::Settings.load({
46
                             :_params => {
47
                               :username => username,
48
                               :password => password,
49
                               :interactive => false
50
                             }})
21 51
end
22 52

  
23 53

  

Also available in: Unified diff