hammer_cli_foreman 2.1.1 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes.md +31 -1
  3. data/doc/testing.md +13 -0
  4. data/lib/hammer_cli_foreman.rb +1 -5
  5. data/lib/hammer_cli_foreman/associating_commands.rb +4 -5
  6. data/lib/hammer_cli_foreman/audit.rb +7 -0
  7. data/lib/hammer_cli_foreman/auth.rb +4 -4
  8. data/lib/hammer_cli_foreman/command_extensions/ping.rb +10 -1
  9. data/lib/hammer_cli_foreman/commands.rb +3 -1
  10. data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +1 -0
  11. data/lib/hammer_cli_foreman/host.rb +3 -2
  12. data/lib/hammer_cli_foreman/hosts/common_update_options.rb +16 -9
  13. data/lib/hammer_cli_foreman/id_resolver.rb +2 -2
  14. data/lib/hammer_cli_foreman/location.rb +2 -0
  15. data/lib/hammer_cli_foreman/option_builders.rb +1 -1
  16. data/lib/hammer_cli_foreman/organization.rb +2 -0
  17. data/lib/hammer_cli_foreman/output/fields.rb +1 -1
  18. data/lib/hammer_cli_foreman/output/formatters.rb +1 -1
  19. data/lib/hammer_cli_foreman/ping.rb +20 -11
  20. data/lib/hammer_cli_foreman/references.rb +16 -0
  21. data/lib/hammer_cli_foreman/settings.rb +14 -0
  22. data/lib/hammer_cli_foreman/testing/api_expectations.rb +10 -0
  23. data/lib/hammer_cli_foreman/version.rb +1 -1
  24. data/lib/minitest/coverage_reporter.rb +94 -0
  25. data/lib/minitest/hammer_coverage_plugin.rb +19 -0
  26. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  27. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  28. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  29. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  30. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  31. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  32. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  33. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  34. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  35. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  36. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  37. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  38. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  39. data/test/functional/audit_test.rb +86 -63
  40. data/test/functional/commands/list_test.rb +11 -11
  41. data/test/functional/compute_profile_test.rb +4 -2
  42. data/test/functional/host_test.rb +43 -18
  43. data/test/functional/location_test.rb +134 -0
  44. data/test/functional/media_test.rb +130 -0
  45. data/test/functional/organization_test.rb +52 -0
  46. data/test/functional/realm_test.rb +103 -0
  47. data/test/functional/role_test.rb +9 -12
  48. data/test/functional/settings_test.rb +57 -1
  49. data/test/functional/user_test.rb +39 -0
  50. data/test/reports/TEST-Minitest-Result.xml +4344 -0
  51. data/test/test_helper.rb +5 -2
  52. data/test/unit/api/interactive_basic_auth_test.rb +3 -1
  53. data/test/unit/api/oauth/oauth_authentication_code_grant_test.rb +2 -2
  54. data/test/unit/api/oauth/oauth_password_grant_test.rb +2 -2
  55. data/test/unit/api_test.rb +3 -4
  56. data/test/unit/apipie_resource_mock.rb +4 -4
  57. data/test/unit/audit_test.rb +1 -0
  58. data/test/unit/commands_test.rb +19 -19
  59. data/test/unit/common_parameter_test.rb +1 -1
  60. data/test/unit/dependency_resolver_test.rb +4 -4
  61. data/test/unit/exception_handler_test.rb +13 -13
  62. data/test/unit/helpers/command.rb +5 -5
  63. data/test/unit/helpers/resource_disabled.rb +2 -2
  64. data/test/unit/host_test.rb +1 -24
  65. data/test/unit/id_resolver_test.rb +23 -23
  66. data/test/unit/media_test.rb +1 -1
  67. data/test/unit/option_builders_test.rb +49 -49
  68. data/test/unit/option_sources/id_params_test.rb +2 -2
  69. data/test/unit/option_sources/ids_params_test.rb +2 -2
  70. data/test/unit/output/formatters_test.rb +21 -21
  71. data/test/unit/param_filters_test.rb +17 -17
  72. data/test/unit/partition_table_test.rb +2 -2
  73. data/test/unit/role_test.rb +2 -2
  74. data/test/unit/sessions_test.rb +24 -24
  75. data/test/unit/template_test.rb +1 -1
  76. metadata +108 -103
  77. data/lib/hammer_cli_foreman/trend.rb +0 -47
  78. data/test/functional/trend_test.rb +0 -22
@@ -17,11 +17,14 @@ require "mocha/minitest"
17
17
  require 'hammer_cli'
18
18
  require 'hammer_cli_foreman/testing/api_expectations'
19
19
 
20
- FOREMAN_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '2.1')
20
+ FOREMAN_VERSION = ENV['TEST_API_VERSION'] || '2.1'
21
+ unless Dir.entries('test/data').include? FOREMAN_VERSION
22
+ raise StandardError.new "Version is not correct"
23
+ end
21
24
 
22
25
  include HammerCLIForeman::Testing::APIExpectations
23
26
  HammerCLI.context[:api_connection].create('foreman') do
24
- api_connection({}, FOREMAN_VERSION)
27
+ api_connection({}, Gem::Version.new(FOREMAN_VERSION))
25
28
  end
26
29
 
27
30
  require 'hammer_cli_foreman'
@@ -44,11 +44,13 @@ describe HammerCLIForeman::Api::InteractiveBasicAuth do
44
44
 
45
45
  context "non-interactive mode" do
46
46
  it "doesn't ask for credentials when they're not provided" do
47
+ HammerCLI.stubs(:interactive?).returns false
47
48
  auth = HammerCLIForeman::Api::InteractiveBasicAuth.new(nil, nil)
48
49
  auth.expects(:ask_user).never
49
-
50
50
  request.expects(:basic_auth).with(nil, nil)
51
51
  auth.authenticate(request, args)
52
+ HammerCLI.unstub(:interactive?)
53
+
52
54
  end
53
55
  end
54
56
 
@@ -23,13 +23,13 @@ describe HammerCLIForeman::Api::Oauth::AuthenticationCodeGrant do
23
23
  it 'sets token as nil when all input parameter are missing' do
24
24
  auth.stubs(:get_code).returns('code')
25
25
  auth.set_token(nil, nil, nil, nil)
26
- assert_equal nil, auth.token
26
+ assert_nil auth.token
27
27
  end
28
28
 
29
29
  it 'sets token as nil when any input parameter is missing' do
30
30
  auth.stubs(:get_code).returns('code')
31
31
  auth.set_token(nil, params[:oidc_authorization_endpoint], params[:oidc_client_id], params[:oidc_redirect_uri])
32
- assert_equal nil, auth.token
32
+ assert_nil auth.token
33
33
  end
34
34
  end
35
35
 
@@ -22,12 +22,12 @@ describe HammerCLIForeman::Api::Oauth::PasswordGrant do
22
22
 
23
23
  it 'sets token as nil when all input parameter are missing' do
24
24
  auth.set_token(nil, nil, nil, nil)
25
- assert_equal nil, auth.token
25
+ assert_nil auth.token
26
26
  end
27
27
 
28
28
  it 'sets token as nil when any input parameter is missing' do
29
29
  auth.set_token(nil, params[:oidc_client_id], params[:username], params[:password])
30
- assert_equal nil, auth.token
30
+ assert_nil auth.token
31
31
  end
32
32
  end
33
33
 
@@ -9,17 +9,16 @@ describe HammerCLIForeman do
9
9
  let(:expected_resource) { HammerCLIForeman.foreman_resource!(:architectures) }
10
10
 
11
11
  it "finds resource for params with _id" do
12
- HammerCLIForeman.param_to_resource("architecture_id").name.must_equal expected_resource.name
12
+ _(HammerCLIForeman.param_to_resource("architecture_id").name).must_equal expected_resource.name
13
13
  end
14
14
 
15
15
  it "finds resource for params without _id" do
16
- HammerCLIForeman.param_to_resource("architecture").name.must_equal expected_resource.name
16
+ _(HammerCLIForeman.param_to_resource("architecture").name).must_equal expected_resource.name
17
17
  end
18
18
 
19
19
  it "returns nil for unknown resource" do
20
- HammerCLIForeman.param_to_resource("unknown").must_equal nil
20
+ assert_nil HammerCLIForeman.param_to_resource("unknown")
21
21
  end
22
-
23
22
  end
24
23
 
25
24
  end
@@ -308,11 +308,11 @@ module ResourceMocks
308
308
  )
309
309
  end
310
310
 
311
- def self.common_parameter_show
312
- ResourceMocks.mock_action_call(:common_parameters, :show, {
311
+ def self.common_parameter_list
312
+ ResourceMocks.mock_action_call(:common_parameters, :index, [{
313
313
  "name" => "my param",
314
- "value" => "random value"
315
- })
314
+ "value" => "random value",
315
+ }])
316
316
  end
317
317
 
318
318
  def self.config_groups_index
@@ -54,6 +54,7 @@ describe HammerCLIForeman::Audit do
54
54
  it_should_print_column "Audit type"
55
55
  it_should_print_column "Audit record"
56
56
  it_should_print_column "Audited changes"
57
+ it_should_print_column "Request UUID"
57
58
  end
58
59
  end
59
60
  end
@@ -19,16 +19,16 @@ describe HammerCLIForeman do
19
19
  ]
20
20
 
21
21
  set = HammerCLIForeman.collection_to_common_format(old_format)
22
- set.must_be_kind_of HammerCLI::Output::RecordCollection
23
- set.first.must_equal(kind)
22
+ _(set).must_be_kind_of HammerCLI::Output::RecordCollection
23
+ _(set.first).must_equal(kind)
24
24
  end
25
25
 
26
26
  it "should convert common API format" do
27
27
  common_format = [ kind ]
28
28
 
29
29
  set = HammerCLIForeman.collection_to_common_format(common_format)
30
- set.must_be_kind_of HammerCLI::Output::RecordCollection
31
- set.first.must_equal(kind)
30
+ _(set).must_be_kind_of HammerCLI::Output::RecordCollection
31
+ _(set.first).must_equal(kind)
32
32
  end
33
33
 
34
34
  it "should convert new API format" do
@@ -46,12 +46,12 @@ describe HammerCLIForeman do
46
46
  }
47
47
 
48
48
  set = HammerCLIForeman.collection_to_common_format(new_format)
49
- set.must_be_kind_of HammerCLI::Output::RecordCollection
50
- set.first.must_equal(kind)
49
+ _(set).must_be_kind_of HammerCLI::Output::RecordCollection
50
+ _(set.first).must_equal(kind)
51
51
  end
52
52
 
53
53
  it "should rise error on unexpected format" do
54
- proc { HammerCLIForeman.collection_to_common_format('unexpected') }.must_raise RuntimeError
54
+ _(proc { HammerCLIForeman.collection_to_common_format('unexpected') }).must_raise RuntimeError
55
55
  end
56
56
 
57
57
  end
@@ -67,14 +67,14 @@ describe HammerCLIForeman do
67
67
  }
68
68
 
69
69
  rec = HammerCLIForeman.record_to_common_format(old_format)
70
- rec.must_equal(arch)
70
+ _(rec).must_equal(arch)
71
71
  end
72
72
 
73
73
  it "should convert common API format" do
74
74
  common_format = arch
75
75
 
76
76
  rec = HammerCLIForeman.record_to_common_format(common_format)
77
- rec.must_equal(arch)
77
+ _(rec).must_equal(arch)
78
78
 
79
79
  end
80
80
  end
@@ -92,7 +92,7 @@ describe HammerCLIForeman do
92
92
  })
93
93
  arch = HammerCLIForeman::Architecture::CreateCommand.new("", { :adapter => :csv, :interactive => false })
94
94
  out, err = capture_io { arch.run(["--name='i386'"]) }
95
- out.must_match("Message,Id,Name\nArchitecture created.,3,i386\n")
95
+ _(out).must_match("Message,Id,Name\nArchitecture created.,3,i386\n")
96
96
  end
97
97
  end
98
98
 
@@ -111,7 +111,7 @@ describe HammerCLIForeman do
111
111
  res.stubs(:get_identifier).returns(1)
112
112
  res.stubs(:get_associated_identifier).returns(1)
113
113
 
114
- res.get_new_ids.sort.must_equal ['1', '2']
114
+ _(res.get_new_ids.sort).must_equal ['1', '2']
115
115
  end
116
116
 
117
117
  it "should associate resource with new format" do
@@ -128,7 +128,7 @@ describe HammerCLIForeman do
128
128
  res.stubs(:get_identifier).returns(1)
129
129
  res.stubs(:get_associated_identifier).returns(1)
130
130
 
131
- res.get_new_ids.sort.must_equal ['1', '2']
131
+ _(res.get_new_ids.sort).must_equal ['1', '2']
132
132
  end
133
133
  end
134
134
 
@@ -152,7 +152,7 @@ describe HammerCLIForeman do
152
152
  end
153
153
  comm = DomainOuter::HostsCommand.new("", { :adapter => :csv, :interactive => false })
154
154
  out, err = capture_io { comm.run(["--id=5"]) }
155
- out.must_equal "Id,Name,Operating System,Host Group,IP,MAC\n2,random-host,,,192.168.100.112,6e:4b:3c:2c:8a:0a\n"
155
+ _(out).must_equal "Id,Name,Operating System,Host Group,IP,MAC\n2,random-host,,,192.168.100.112,6e:4b:3c:2c:8a:0a\n"
156
156
  end
157
157
  end
158
158
 
@@ -163,7 +163,7 @@ describe HammerCLIForeman::Command do
163
163
 
164
164
  it "uses foreman option builder" do
165
165
  builder = HammerCLIForeman::Command.option_builder
166
- builder.class.must_equal HammerCLIForeman::ForemanOptionBuilder
166
+ _(builder.class).must_equal HammerCLIForeman::ForemanOptionBuilder
167
167
  end
168
168
 
169
169
  it "properly raises error on intentional searching of parameters that are not required" do
@@ -181,9 +181,9 @@ describe HammerCLIForeman::Command do
181
181
  )
182
182
  )
183
183
  out, err = capture_io do
184
- com.run(['--location', 'loc']).wont_equal HammerCLI::EX_OK
184
+ _(com.run(['--location', 'loc'])).wont_equal HammerCLI::EX_OK
185
185
  end
186
- err.must_equal "Error: Could not find location, please set one of options --location, --location-title, --location-id.\n"
186
+ _(err).must_equal "Error: Could not find location, please set one of options --location, --location-title, --location-id.\n"
187
187
 
188
188
  end
189
189
 
@@ -205,7 +205,7 @@ describe HammerCLIForeman::Command do
205
205
  ResourceMocks.mock_action_call(:domains, :index, [])
206
206
 
207
207
  out, err = capture_io do
208
- com.run([]).must_equal HammerCLI::EX_OK
208
+ _(com.run([])).must_equal HammerCLI::EX_OK
209
209
  end
210
210
 
211
211
  end
@@ -213,7 +213,7 @@ describe HammerCLIForeman::Command do
213
213
  describe "build_options" do
214
214
  it "uses build parameters in the block" do
215
215
  HammerCLIForeman::Command.build_options do |o|
216
- o.class.must_equal HammerCLIForeman::BuildParams
216
+ _(o.class).must_equal HammerCLIForeman::BuildParams
217
217
  end
218
218
  end
219
219
  end
@@ -228,6 +228,6 @@ describe HammerCLIForeman::ListCommand do
228
228
  it 'formats enum values in search fields help' do
229
229
  search_field = { name: 'managed', values: [true, false] }
230
230
  expected_output = 'Values: true, false'
231
- OpenListCommand.new({}).search_field_help_value(search_field).must_equal(expected_output)
231
+ _(OpenListCommand.new({}).search_field_help_value(search_field)).must_equal(expected_output)
232
232
  end
233
233
  end
@@ -31,7 +31,7 @@ describe HammerCLIForeman::CommonParameter do
31
31
 
32
32
  context "SetCommand" do
33
33
  before do
34
- ResourceMocks.common_parameter_show
34
+ ResourceMocks.common_parameter_list
35
35
  end
36
36
 
37
37
  let(:cmd) { HammerCLIForeman::CommonParameter::SetCommand.new("", ctx) }
@@ -20,7 +20,7 @@ describe HammerCLIForeman::DependencyResolver do
20
20
 
21
21
  it "returns empty array for an independent resource" do
22
22
  resource = api.resource(:users)
23
- resolver.resource_dependencies(resource).must_equal []
23
+ _(resolver.resource_dependencies(resource)).must_equal []
24
24
  end
25
25
 
26
26
  it "returns list of dependent resources" do
@@ -28,7 +28,7 @@ describe HammerCLIForeman::DependencyResolver do
28
28
 
29
29
  resources = resolver.resource_dependencies(resource).map(&:name).sort_by{ |sym| sym.to_s }
30
30
  expected = [:posts, :users]
31
- resources.must_equal expected.sort_by{ |sym| sym.to_s }
31
+ _(resources).must_equal expected.sort_by{ |sym| sym.to_s }
32
32
  end
33
33
  end
34
34
 
@@ -36,14 +36,14 @@ describe HammerCLIForeman::DependencyResolver do
36
36
 
37
37
  it "returns empty array for an independent action" do
38
38
  action = HammerCLIForeman.foreman_resource!(:users).action(:index)
39
- resolver.action_dependencies(action).must_equal []
39
+ _(resolver.action_dependencies(action)).must_equal []
40
40
  end
41
41
 
42
42
  it "returns list of dependent resources" do
43
43
  action = HammerCLIForeman.foreman_resource!(:comments).action(:create)
44
44
  resources = resolver.action_dependencies(action).map(&:name).sort_by{ |sym| sym.to_s }
45
45
  expected = [:posts, :users]
46
- resources.must_equal expected.sort_by{|sym| sym.to_s}
46
+ _(resources).must_equal expected.sort_by{|sym| sym.to_s}
47
47
  end
48
48
  end
49
49
  end
@@ -15,7 +15,7 @@ describe HammerCLIForeman::ExceptionHandler do
15
15
  ex = RestClient::UnprocessableEntity.new(response)
16
16
  output.expects(:print_error).with(heading, "Network address can't be blank\nNetwork address is invalid\nName can't be blank")
17
17
  err_code = handler.handle_exception(ex, :heading => heading)
18
- err_code.must_equal HammerCLI::EX_DATAERR
18
+ _(err_code).must_equal HammerCLI::EX_DATAERR
19
19
  end
20
20
 
21
21
  it "should print resource errors on unprocessable entity exception" do
@@ -26,21 +26,21 @@ describe HammerCLIForeman::ExceptionHandler do
26
26
  ex = RestClient::UnprocessableEntity.new(response)
27
27
  output.expects(:print_error).with(heading, "Network address can't be blank\nNetwork address is invalid\nName can't be blank")
28
28
  err_code = handler.handle_exception(ex, :heading => heading)
29
- err_code.must_equal HammerCLI::EX_DATAERR
29
+ _(err_code).must_equal HammerCLI::EX_DATAERR
30
30
  end
31
31
 
32
32
  it "should handle argument error" do
33
33
  ex = ArgumentError.new
34
34
  output.expects(:print_error).with(heading, ex.message)
35
35
  err_code = handler.handle_exception(ex, :heading => heading)
36
- err_code.must_equal HammerCLI::EX_USAGE
36
+ _(err_code).must_equal HammerCLI::EX_USAGE
37
37
  end
38
38
 
39
39
  it "should handle forbidden error" do
40
40
  ex = RestClient::Forbidden.new
41
41
  output.expects(:print_error).with('Forbidden - server refused to process the request.', nil)
42
42
  err_code = handler.handle_exception(ex)
43
- err_code.must_equal HammerCLI::EX_NOPERM
43
+ _(err_code).must_equal HammerCLI::EX_NOPERM
44
44
  end
45
45
 
46
46
  it "handles forbidden error with permission details" do
@@ -57,13 +57,13 @@ describe HammerCLIForeman::ExceptionHandler do
57
57
  output.expects(:print_error).with(heading, "Error: message")
58
58
  MyException = Class.new(Exception)
59
59
  err_code = handler.handle_exception(MyException.new('message'), :heading => heading)
60
- err_code.must_equal HammerCLI::EX_SOFTWARE
60
+ _(err_code).must_equal HammerCLI::EX_SOFTWARE
61
61
  end
62
62
 
63
63
  it "should handle unsupported operation error" do
64
64
  output.expects(:print_error).with(heading, "message")
65
65
  err_code = handler.handle_exception(HammerCLIForeman::OperationNotSupportedError.new('message'), :heading => heading)
66
- err_code.must_equal HammerCLI::EX_UNAVAILABLE
66
+ _(err_code).must_equal HammerCLI::EX_UNAVAILABLE
67
67
  end
68
68
 
69
69
  it "should print resource errors on resource not found exception" do
@@ -75,7 +75,7 @@ describe HammerCLIForeman::ExceptionHandler do
75
75
 
76
76
  output.expects(:print_error).with(heading, "Resource architecture not found by id '1'")
77
77
  err_code = handler.handle_exception(ex, :heading => heading)
78
- err_code.must_equal HammerCLI::EX_NOT_FOUND
78
+ _(err_code).must_equal HammerCLI::EX_NOT_FOUND
79
79
  end
80
80
 
81
81
  it "should print exception message on resource not found exception without explicit message" do
@@ -85,7 +85,7 @@ describe HammerCLIForeman::ExceptionHandler do
85
85
 
86
86
  output.expects(:print_error).with(heading, "ResourceNotFound message")
87
87
  err_code = handler.handle_exception(ex, :heading => heading)
88
- err_code.must_equal HammerCLI::EX_NOT_FOUND
88
+ _(err_code).must_equal HammerCLI::EX_NOT_FOUND
89
89
  end
90
90
 
91
91
  it "should print resource errors on internal error exception" do
@@ -97,7 +97,7 @@ describe HammerCLIForeman::ExceptionHandler do
97
97
 
98
98
  output.expects(:print_error).with(heading, "Some internal exception")
99
99
  err_code = handler.handle_exception(ex, :heading => heading)
100
- err_code.must_equal HammerCLI::EX_SOFTWARE
100
+ _(err_code).must_equal HammerCLI::EX_SOFTWARE
101
101
  end
102
102
 
103
103
  it "should print exception message on internal error exception without formatted message" do
@@ -110,7 +110,7 @@ describe HammerCLIForeman::ExceptionHandler do
110
110
 
111
111
  output.expects(:print_error).with(heading, "Unformatted\nlines\n")
112
112
  err_code = handler.handle_exception(ex, :heading => heading)
113
- err_code.must_equal HammerCLI::EX_SOFTWARE
113
+ _(err_code).must_equal HammerCLI::EX_SOFTWARE
114
114
  end
115
115
 
116
116
  it "should print exception message on internal error exception with message that is not nested" do
@@ -122,7 +122,7 @@ describe HammerCLIForeman::ExceptionHandler do
122
122
 
123
123
  output.expects(:print_error).with(heading, "Some internal exception")
124
124
  err_code = handler.handle_exception(ex, :heading => heading)
125
- err_code.must_equal HammerCLI::EX_SOFTWARE
125
+ _(err_code).must_equal HammerCLI::EX_SOFTWARE
126
126
  end
127
127
 
128
128
  context "redirects" do
@@ -133,7 +133,7 @@ describe HammerCLIForeman::ExceptionHandler do
133
133
 
134
134
  output.expects(:print_error).with(heading, "Redirection of API call detected.\nIt seems hammer is configured to use HTTP and the server prefers HTTPS.\nUpdate your server url configuration.\nYou can set 'follow_redirects' to one of :default or :always to enable redirects following.")
135
135
  err_code = handler.handle_exception(ex, :heading => heading)
136
- err_code.must_equal HammerCLI::EX_CONFIG
136
+ _(err_code).must_equal HammerCLI::EX_CONFIG
137
137
  end
138
138
 
139
139
  it "should detect redirection error" do
@@ -142,7 +142,7 @@ describe HammerCLIForeman::ExceptionHandler do
142
142
 
143
143
  output.expects(:print_error).with(heading, "Redirection of API call detected.\nUpdate your server url configuration.\nYou can set 'follow_redirects' to one of :default or :always to enable redirects following.")
144
144
  err_code = handler.handle_exception(ex, :heading => heading)
145
- err_code.must_equal HammerCLI::EX_CONFIG
145
+ _(err_code).must_equal HammerCLI::EX_CONFIG
146
146
  end
147
147
  end
148
148
 
@@ -97,14 +97,14 @@ module CommandTestHelper
97
97
 
98
98
  def it_should_fail_with(message, arguments=[])
99
99
  it "should fail with " + message.to_s do
100
- cmd.run(arguments).must_equal HammerCLI::EX_USAGE
100
+ _(cmd.run(arguments)).must_equal HammerCLI::EX_USAGE
101
101
  end
102
102
  end
103
103
 
104
104
  def it_should_accept(message, arguments=[])
105
105
  it "should accept " + message.to_s do
106
106
  out, err = capture_io do
107
- cmd.run(arguments).must_equal HammerCLI::EX_OK
107
+ _(cmd.run(arguments)).must_equal HammerCLI::EX_OK
108
108
  end
109
109
  end
110
110
  end
@@ -116,7 +116,7 @@ module CommandTestHelper
116
116
  out, err = capture_io do
117
117
  cmd.run(arguments)
118
118
  end
119
- out.must_include message
119
+ _(out).must_include message
120
120
  end
121
121
  end
122
122
 
@@ -129,7 +129,7 @@ module CommandTestHelper
129
129
  cmd.run(arguments)
130
130
  end
131
131
 
132
- out.split("\n")[0].must_match /.*##{column_name}#.*/
132
+ _(out.split("\n")[0]).must_match /.*##{column_name}#.*/
133
133
  end
134
134
  end
135
135
 
@@ -148,7 +148,7 @@ module CommandTestHelper
148
148
  out, err = capture_io do
149
149
  cmd.run(arguments)
150
150
  end
151
- out.split(/\n/).length.must_equal count+1 # plus 1 for line with column headers
151
+ _(out.split(/\n/).length).must_equal count+1 # plus 1 for line with column headers
152
152
  end
153
153
  end
154
154
 
@@ -9,7 +9,7 @@ module ResourceDisabled
9
9
  it "should return error" do
10
10
  cmd.class.resource.stubs(:call).raises(RestClient::ResourceNotFound)
11
11
  arguments = respond_to?(:with_params) ? with_params : []
12
- cmd.run(arguments).must_equal HammerCLI::EX_UNAVAILABLE
12
+ _(cmd.run(arguments)).must_equal HammerCLI::EX_UNAVAILABLE
13
13
  end
14
14
 
15
15
  it "should print error message" do
@@ -17,7 +17,7 @@ module ResourceDisabled
17
17
  cmd.stubs(:context).returns(ctx.update(:adapter => :test))
18
18
 
19
19
  arguments = respond_to?(:with_params) ? with_params : []
20
- lambda { cmd.run(arguments) }.must_output "", /.*not support.*/
20
+ _(lambda { cmd.run(arguments) }).must_output "", /.*not support.*/
21
21
  end
22
22
  end
23
23
  end