hammer_cli_foreman 2.1.2 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes.md +32 -4
  3. data/doc/testing.md +13 -0
  4. data/lib/hammer_cli_foreman.rb +0 -4
  5. data/lib/hammer_cli_foreman/associating_commands.rb +4 -5
  6. data/lib/hammer_cli_foreman/auth.rb +4 -4
  7. data/lib/hammer_cli_foreman/command_extensions/ping.rb +10 -1
  8. data/lib/hammer_cli_foreman/commands.rb +3 -1
  9. data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +1 -0
  10. data/lib/hammer_cli_foreman/host.rb +3 -2
  11. data/lib/hammer_cli_foreman/hosts/common_update_options.rb +16 -9
  12. data/lib/hammer_cli_foreman/location.rb +2 -0
  13. data/lib/hammer_cli_foreman/option_builders.rb +21 -2
  14. data/lib/hammer_cli_foreman/organization.rb +2 -0
  15. data/lib/hammer_cli_foreman/output/fields.rb +1 -1
  16. data/lib/hammer_cli_foreman/output/formatters.rb +1 -1
  17. data/lib/hammer_cli_foreman/ping.rb +20 -11
  18. data/lib/hammer_cli_foreman/references.rb +16 -0
  19. data/lib/hammer_cli_foreman/settings.rb +14 -0
  20. data/lib/hammer_cli_foreman/testing/api_expectations.rb +10 -0
  21. data/lib/hammer_cli_foreman/version.rb +1 -1
  22. data/lib/minitest/coverage_reporter.rb +94 -0
  23. data/lib/minitest/hammer_coverage_plugin.rb +19 -0
  24. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  25. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  26. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  27. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  28. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  29. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  30. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  31. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  32. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  33. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  34. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  35. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  36. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  37. data/test/functional/audit_test.rb +86 -63
  38. data/test/functional/commands/list_test.rb +11 -11
  39. data/test/functional/compute_profile_test.rb +4 -2
  40. data/test/functional/host_test.rb +43 -18
  41. data/test/functional/location_test.rb +134 -0
  42. data/test/functional/media_test.rb +130 -0
  43. data/test/functional/organization_test.rb +52 -0
  44. data/test/functional/realm_test.rb +103 -0
  45. data/test/functional/role_test.rb +9 -12
  46. data/test/functional/settings_test.rb +57 -1
  47. data/test/functional/user_test.rb +39 -0
  48. data/test/test_helper.rb +5 -2
  49. data/test/unit/api/interactive_basic_auth_test.rb +3 -1
  50. data/test/unit/api/oauth/oauth_authentication_code_grant_test.rb +2 -2
  51. data/test/unit/api/oauth/oauth_password_grant_test.rb +2 -2
  52. data/test/unit/api_test.rb +3 -4
  53. data/test/unit/apipie_resource_mock.rb +4 -4
  54. data/test/unit/commands_test.rb +19 -19
  55. data/test/unit/common_parameter_test.rb +1 -1
  56. data/test/unit/dependency_resolver_test.rb +4 -4
  57. data/test/unit/exception_handler_test.rb +13 -13
  58. data/test/unit/helpers/command.rb +5 -5
  59. data/test/unit/helpers/resource_disabled.rb +2 -2
  60. data/test/unit/host_test.rb +1 -24
  61. data/test/unit/id_resolver_test.rb +23 -23
  62. data/test/unit/media_test.rb +1 -1
  63. data/test/unit/option_builders_test.rb +49 -49
  64. data/test/unit/option_sources/id_params_test.rb +2 -2
  65. data/test/unit/option_sources/ids_params_test.rb +2 -2
  66. data/test/unit/output/formatters_test.rb +21 -21
  67. data/test/unit/param_filters_test.rb +17 -17
  68. data/test/unit/partition_table_test.rb +2 -2
  69. data/test/unit/role_test.rb +2 -2
  70. data/test/unit/sessions_test.rb +24 -24
  71. data/test/unit/template_test.rb +1 -1
  72. metadata +105 -104
  73. data/lib/hammer_cli_foreman/trend.rb +0 -47
  74. data/test/functional/trend_test.rb +0 -22
  75. data/test/reports/TEST-Minitest-Result.xml +0 -4344
@@ -1,5 +1,5 @@
1
1
  module HammerCLIForeman
2
2
  def self.version
3
- @version ||= Gem::Version.new "2.1.2"
3
+ @version ||= Gem::Version.new "2.3.2"
4
4
  end
5
5
  end
@@ -0,0 +1,94 @@
1
+ require "json"
2
+
3
+ module Minitest
4
+ class CoverageRunner
5
+
6
+ RESOURCE_BLACK_LIST = ['tasks','home','config_groups','statistics','table_preferences','autosign','puppet_hosts']
7
+ attr_reader :raw_data, :api_endpoints, :covered_resources, :uncovered_resources, :partially_covered_resources
8
+ def initialize(file_path)
9
+ @raw_data = JSON.load(File.open(file_path))
10
+ @api_endpoints = {}
11
+ @covered_resources = []
12
+ @uncovered_resources = []
13
+ @partially_covered_resources = {}
14
+ end
15
+
16
+ def filtered_endpoints(covered)
17
+ api_endpoints.select { |_k, v| v == covered }.keys
18
+ end
19
+
20
+ def get_endpoints_by_resource(endpoints)
21
+ endpoints_by_resource = {}
22
+ endpoints.each do |url|
23
+ resource,action = url.split("/")
24
+ endpoints_by_resource[resource] ||= []
25
+ endpoints_by_resource[resource] << action
26
+ end
27
+ endpoints_by_resource
28
+ end
29
+
30
+ def uncovered_endpoints_by_resource
31
+ get_endpoints_by_resource(filtered_endpoints(false))
32
+ end
33
+
34
+ def covered_endpoints_by_resource
35
+ get_endpoints_by_resource(filtered_endpoints(true))
36
+ end
37
+
38
+ def get_coverage
39
+ get_endpoints_by_resource(api_endpoints.keys).each do |resource, actions|
40
+ if covered_endpoints_by_resource[resource] == actions
41
+ @covered_resources << resource
42
+ elsif uncovered_endpoints_by_resource[resource] == actions
43
+ @uncovered_resources << resource
44
+ else
45
+ @partially_covered_resources[resource] = uncovered_endpoints_by_resource[resource]
46
+ end
47
+ end
48
+ end
49
+
50
+ def endpoints_percentage(endpoints)
51
+ "#{(endpoints.count / api_endpoints.count.to_f * 100 ).to_i}%"
52
+ end
53
+
54
+ def uncovered_endpoints_percentage
55
+ endpoints_percentage(filtered_endpoints(false))
56
+ end
57
+
58
+ def covered_endpoints_percentage
59
+ endpoints_percentage(filtered_endpoints(true))
60
+ end
61
+
62
+ def run_tests
63
+ raw_data["docs"]["resources"].each do |resource|
64
+ resource[1]["methods"].each do | method |
65
+ @api_endpoints[method["doc_url"].delete_prefix!("../apidoc/v2/")] = false
66
+ end unless RESOURCE_BLACK_LIST.include? resource[0]
67
+ end
68
+ HammerCLIForeman::Testing::APIExpectations.api_calls.each do |api_call|
69
+ resource, action = api_call
70
+ url = "#{resource}/#{action}"
71
+ @api_endpoints[url] = true
72
+ end
73
+ get_coverage
74
+ output_coverage
75
+ end
76
+
77
+ def color(str, code)
78
+ puts "\e[#{code}m#{str}\e[0m"
79
+ end
80
+
81
+ def output_coverage
82
+ covered_resources
83
+ color("COVERED RESOURCES" , 32)
84
+ puts covered_resources
85
+ color("NOT COVERED AT ALL", 31)
86
+ puts uncovered_resources
87
+ color("PARTIALLY COVERED RESOURCES", 33)
88
+ partially_covered_resources.each do |resource, endpoints|
89
+ puts "#{resource}: #{endpoints.join(' ')}"
90
+ end
91
+ color("covered endpoints #{covered_endpoints_percentage} uncovered endpoints #{uncovered_endpoints_percentage}", 35)
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,19 @@
1
+ require 'coverage_reporter'
2
+ require "json"
3
+
4
+ module Minitest
5
+ def self.plugin_hammer_coverage_options(opts, options)
6
+ opts.on "-c", "--coverage", "Generate coverage reports for API endpoints" do
7
+ options[:coverage] = true
8
+ end
9
+ end
10
+
11
+ def self.plugin_hammer_coverage_init(options)
12
+ if options[:coverage]
13
+ Minitest.reporter.reporters.clear
14
+ Minitest.after_run do
15
+ Minitest::CoverageRunner.new("test/data/#{ FOREMAN_VERSION }/foreman_api.json").run_tests
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,28 +1,28 @@
1
1
  require File.join(File.dirname(__FILE__), 'test_helper')
2
2
 
3
3
  describe 'audit' do
4
- describe 'audit-list' do
4
+ before do
5
+ @audit_changed = {
6
+ 'id' => 83,
7
+ 'created_at' => "2017-10-31 11:25:44 UTC",
8
+ 'remote_address' => '::1',
9
+ 'user_name' => "foreman_api_admin",
10
+ 'user_id' => 11,
11
+ 'action' => "update",
12
+ 'auditable_type' => "ProvisioningTemplate",
13
+ 'auditable_name' => "default_location_subscribed_hosts",
14
+ 'auditable_id' => 32,
15
+ 'audited_changes' => {
16
+ 'value' => [
17
+ nil,
18
+ "--- false\n..."
19
+ ]
20
+ }
21
+ }
22
+ end
23
+ describe 'audit-info' do
5
24
  let (:cmd) { ['audit', 'info'] }
6
25
  let(:params) { ['--id=83'] }
7
- let(:audit_changed) do
8
- {
9
- 'id' => 83,
10
- 'created_at' => "2017-10-31 11:25:44 UTC",
11
- 'remote_address' => '::1',
12
- 'user_name' => "foreman_api_admin",
13
- 'user_id' => 11,
14
- 'action' => "update",
15
- 'auditable_type' => "ProvisioningTemplate",
16
- 'auditable_name' => "default_location_subscribed_hosts",
17
- 'auditable_id' => 32,
18
- 'audited_changes' => {
19
- 'value' => [
20
- nil,
21
- "--- false\n..."
22
- ]
23
- }
24
- }
25
- end
26
26
  let(:audit_new) do
27
27
  {
28
28
  "user_id" => 1,
@@ -62,24 +62,26 @@ describe 'audit' do
62
62
  it 'shows audit information for changed records' do
63
63
  api_expects(:audits, :show, 'info')
64
64
  .with_params('id' => '83')
65
- .returns(audit_changed)
65
+ .returns(@audit_changed)
66
66
 
67
- output = OutputMatcher.new([
68
- 'Id: 83',
69
- 'At: 2017/10/31 11:25:44',
70
- 'IP: ::1',
71
- 'User: foreman_api_admin',
72
- 'Action: update',
73
- 'Audit type: ProvisioningTemplate',
74
- 'Audit record: default_location_subscribed_hosts',
75
- 'Audited changes:',
76
- ' 1) Attribute: value',
77
- ' Old:',
78
- '',
79
- ' New:',
80
- ' --- false',
81
- ' ...',
82
- ])
67
+ output = OutputMatcher.new(
68
+ [
69
+ 'Id: 83',
70
+ 'At: 2017/10/31 11:25:44',
71
+ 'IP: ::1',
72
+ 'User: foreman_api_admin',
73
+ 'Action: update',
74
+ 'Audit type: ProvisioningTemplate',
75
+ 'Audit record: default_location_subscribed_hosts',
76
+ 'Audited changes:',
77
+ ' 1) Attribute: value',
78
+ ' Old:',
79
+ '',
80
+ ' New:',
81
+ ' --- false',
82
+ ' ...',
83
+ ]
84
+ )
83
85
  expected_result = success_result(output)
84
86
 
85
87
  result = run_cmd(cmd + params)
@@ -91,36 +93,57 @@ describe 'audit' do
91
93
  .with_params('id' => '83')
92
94
  .returns(audit_new)
93
95
 
94
- output = OutputMatcher.new([
95
- 'Id: 63',
96
- 'At: 2017/10/09 23:42:44',
97
- 'IP: ::1',
98
- 'User: foreman_admin',
99
- 'Action: create',
100
- 'Audit type: User',
101
- 'Audit record: John Doe',
102
- 'Audited changes:',
103
- ' 1) Attribute: login',
104
- ' Value: john',
105
- ' 2) Attribute: firstname',
106
- ' Value: John',
107
- ' 3) Attribute: lastname',
108
- ' Value: Doe',
109
- ' 4) Attribute: mail',
110
- ' Value: john@ipa.test',
111
- ' 5) Attribute: admin',
112
- ' Value: false',
113
- ' 6) Attribute: auth_source_id',
114
- ' Value: 3',
115
- ' 7) Attribute: lower_login',
116
- ' Value: john',
117
- ' 8) Attribute: mail_enabled',
118
- ' Value: true',
119
- ])
96
+ output = OutputMatcher.new(
97
+ [
98
+ 'Id: 63',
99
+ 'At: 2017/10/09 23:42:44',
100
+ 'IP: ::1',
101
+ 'User: foreman_admin',
102
+ 'Action: create',
103
+ 'Audit type: User',
104
+ 'Audit record: John Doe',
105
+ 'Audited changes:',
106
+ ' 1) Attribute: login',
107
+ ' Value: john',
108
+ ' 2) Attribute: firstname',
109
+ ' Value: John',
110
+ ' 3) Attribute: lastname',
111
+ ' Value: Doe',
112
+ ' 4) Attribute: mail',
113
+ ' Value: john@ipa.test',
114
+ ' 5) Attribute: admin',
115
+ ' Value: false',
116
+ ' 6) Attribute: auth_source_id',
117
+ ' Value: 3',
118
+ ' 7) Attribute: lower_login',
119
+ ' Value: john',
120
+ ' 8) Attribute: mail_enabled',
121
+ ' Value: true',
122
+ ]
123
+ )
120
124
  expected_result = success_result(output)
121
125
 
122
126
  result = run_cmd(cmd + params)
123
127
  assert_cmd(expected_result, result)
124
128
  end
125
129
  end
130
+
131
+ describe 'audit-list' do
132
+ let(:cmd) { ['audit', 'list'] }
133
+ let(:audits) do
134
+ [@audit_changed]
135
+ end
136
+
137
+ it "should show index list" do
138
+ api_expects(:audits, :index).returns(audits)
139
+
140
+ output = IndexMatcher.new([
141
+ ['ID', 'AT', 'IP', 'USER', 'ACTION', 'AUDIT TYPE', 'AUDIT RECORD'],
142
+ ['83', '2017/10/31 11:25:44', '::1', 'foreman_api_admin', 'update', 'ProvisioningTemplate', 'default_location_subscribed_hosts']
143
+ ])
144
+
145
+ result = run_cmd(cmd)
146
+ assert_cmd(success_result(output), result)
147
+ end
148
+ end
126
149
  end
@@ -39,12 +39,12 @@ describe HammerCLIForeman::ListCommand do
39
39
 
40
40
  it 'shows search fields in help' do
41
41
  result = run_cmd(cmd + params)
42
- result.out.must_match(/.*Search \/ Order fields:\s+(\S+\s+\S+)*\s+name\s+string/)
42
+ _(result.out).must_match(/.*Search \/ Order fields:\s+(\S+\s+\S+)*\s+name\s+string/)
43
43
  end
44
44
 
45
45
  it 'formats enum values' do
46
46
  result = run_cmd(cmd + params)
47
- result.out.must_match(/.*Search \/ Order fields:\s+(\S+\s+\S+)*\s+managed\s+Values: true, false/)
47
+ _(result.out).must_match(/.*Search \/ Order fields:\s+(\S+\s+\S+)*\s+managed\s+Values: true, false/)
48
48
  end
49
49
  end
50
50
 
@@ -53,7 +53,7 @@ describe HammerCLIForeman::ListCommand do
53
53
  it "fetches only first page when there's not enough records" do
54
54
  expect_paged_call(1, 1000, 10)
55
55
  result = run_cmd([], {}, TestList)
56
- result.exit_code.must_equal HammerCLI::EX_OK
56
+ _(result.exit_code).must_equal HammerCLI::EX_OK
57
57
  end
58
58
 
59
59
  it "fetches all records" do
@@ -62,27 +62,27 @@ describe HammerCLIForeman::ListCommand do
62
62
  expect_paged_call(3, per_page_all, 10)
63
63
 
64
64
  result = run_cmd([], {}, TestList)
65
- result.exit_code.must_equal HammerCLI::EX_OK
65
+ _(result.exit_code).must_equal HammerCLI::EX_OK
66
66
  end
67
67
 
68
68
  it "uses --per-page value" do
69
69
  per_page = 10
70
70
  expect_paged_call(1, per_page, 10)
71
71
  result = run_cmd(["--per-page=#{per_page}"], {}, TestList)
72
- result.exit_code.must_equal HammerCLI::EX_OK
72
+ _(result.exit_code).must_equal HammerCLI::EX_OK
73
73
  end
74
74
 
75
75
  it "uses both --per-page and --page value" do
76
76
  per_page = 10
77
77
  expect_paged_call(2, per_page, 10)
78
78
  result = run_cmd(["--per-page=#{per_page}", '--page=2'], {}, TestList)
79
- result.exit_code.must_equal HammerCLI::EX_OK
79
+ _(result.exit_code).must_equal HammerCLI::EX_OK
80
80
  end
81
81
 
82
82
  it "sets per_page to 20 when only --page is used" do
83
83
  expect_paged_call(2, 20, 10)
84
84
  result = run_cmd(['--page=2'], {}, TestList)
85
- result.exit_code.must_equal HammerCLI::EX_OK
85
+ _(result.exit_code).must_equal HammerCLI::EX_OK
86
86
  end
87
87
  end
88
88
 
@@ -96,20 +96,20 @@ describe HammerCLIForeman::ListCommand do
96
96
  per_page = 10
97
97
  expect_paged_call(1, per_page, 10)
98
98
  result = run_cmd(["--per-page=#{per_page}"], {}, TestList)
99
- result.exit_code.must_equal HammerCLI::EX_OK
99
+ _(result.exit_code).must_equal HammerCLI::EX_OK
100
100
  end
101
101
 
102
102
  it "respects per_page setting when the adapter allows pagination by default" do
103
103
  expect_paged_call(1, per_page_in_settings, 30)
104
104
  result = run_cmd([], { :adapter => :base, :interactive => false }, TestList)
105
- result.exit_code.must_equal HammerCLI::EX_OK
105
+ _(result.exit_code).must_equal HammerCLI::EX_OK
106
106
  end
107
107
 
108
108
  it "fetches all records when the adapter doesn't allow pagination by default" do
109
109
  expect_paged_call(1, per_page_all, 1000)
110
110
  expect_paged_call(2, per_page_all, 10)
111
111
  result = run_cmd([], { :adapter => :csv, :interactive => false }, TestList)
112
- result.exit_code.must_equal HammerCLI::EX_OK
112
+ _(result.exit_code).must_equal HammerCLI::EX_OK
113
113
  end
114
114
  end
115
115
  end
@@ -128,7 +128,7 @@ describe HammerCLIForeman::ListCommand do
128
128
 
129
129
  result = run_cmd([], {}, TestListWithOutput)
130
130
  assert_cmd(expected_result, result)
131
- result.out.wont_match pagination_line_re
131
+ _(result.out).wont_match pagination_line_re
132
132
  end
133
133
 
134
134
  it 'prints one page when --per-page is used' do
@@ -33,8 +33,10 @@ describe "parameters" do
33
33
  }
34
34
  end
35
35
  it 'update compute profile name' do
36
- params = ['--id=1' ,'--new-name=profile2']
37
- api_expects(:compute_profiles, :update, 'Update the compute profile').with_params({"name" =>"profile2"}).returns(@compute_profile)
36
+ params = ['--id=1', '--new-name=profile2']
37
+ api_expects(:compute_profiles, :update, 'Update the compute profile').with_params(
38
+ { 'compute_profile' => { 'name' => 'profile2' } }
39
+ ).returns(@compute_profile)
38
40
  result = run_cmd(@cmd + params)
39
41
  assert_cmd(success_result("Compute profile updated.\n"), result)
40
42
  end
@@ -315,6 +315,26 @@ describe 'host update' do
315
315
  }
316
316
  end
317
317
 
318
+ it 'updates with passed options only' do
319
+ params = ['--new-name=new-name']
320
+ expected_result = success_result("Host updated.\n")
321
+
322
+ api_expects(:hosts, :update, 'Update host name only').with_params(
323
+ 'id' => '1', 'organization_id' => 1, 'location_id' => 1,
324
+ 'host' => { 'name' => 'new-name' }
325
+ ).returns(
326
+ {
327
+ 'id' => '1',
328
+ 'name' => 'new-name',
329
+ 'organization_id' => '1',
330
+ 'location_id' => '1'
331
+ }
332
+ )
333
+
334
+ result = run_cmd(cmd + minimal_params + params)
335
+ assert_cmd(expected_result, result)
336
+ end
337
+
318
338
  it 'ensures helper methods are invoked' do
319
339
  params = ['--image-id=1']
320
340
  expected_result = success_result("Host updated.\n")
@@ -350,12 +370,9 @@ describe 'host update' do
350
370
  )
351
371
  api_expects(:hosts, :update, 'Update host with new org').with_params(
352
372
  'id' => '1', 'location_id' => 1, 'organization_id' => 1, 'host' => {
353
- 'organization_id' => '5', 'compute_attributes' => {}
354
- }
373
+ 'organization_id' => '5' }
355
374
  ) do |par|
356
- par['id'] == '1' &&
357
- par['host']['organization_id'] == '5' &&
358
- par['host']['compute_attributes'] == {}
375
+ par['id'] == '1' && par['host']['organization_id'] == '5'
359
376
  end.returns(updated_host)
360
377
 
361
378
  expected_result = success_result("Host updated.\n")
@@ -373,12 +390,9 @@ describe 'host update' do
373
390
  )
374
391
  api_expects(:hosts, :update, 'Update host with new loc').with_params(
375
392
  'id' => '1', 'location_id' => 1, 'organization_id' => 1, 'host' => {
376
- 'location_id' => '5', 'compute_attributes' => {}
377
- }
393
+ 'location_id' => '5' }
378
394
  ) do |par|
379
- par['id'] == '1' &&
380
- par['host']['location_id'] == '5' &&
381
- par['host']['compute_attributes'] == {}
395
+ par['id'] == '1' && par['host']['location_id'] == '5'
382
396
  end.returns(updated_host)
383
397
 
384
398
  expected_result = success_result("Host updated.\n")
@@ -396,12 +410,9 @@ describe 'host update' do
396
410
  )
397
411
  api_expects(:hosts, :update, 'Update host with new owner').with_params(
398
412
  'id' => '1', 'location_id' => 1, 'organization_id' => 1, 'host' => {
399
- 'owner_id' => '1', 'compute_attributes' => {}
400
- }
413
+ 'owner_id' => '1' }
401
414
  ) do |par|
402
- par['id'] == '1' &&
403
- par['host']['owner_id'] == '1' &&
404
- par['host']['compute_attributes'] == {}
415
+ par['id'] == '1' && par['host']['owner_id'] == '1'
405
416
  end.returns(updated_host)
406
417
 
407
418
  expected_result = success_result("Host updated.\n")
@@ -428,7 +439,7 @@ describe 'host config reports' do
428
439
  end.returns(index_response([report15]))
429
440
 
430
441
  result = run_cmd(['host', 'config-reports', '--id=1'])
431
- result.exit_code.must_equal HammerCLI::EX_OK
442
+ _(result.exit_code).must_equal HammerCLI::EX_OK
432
443
  end
433
444
 
434
445
  it 'filters reports by --name' do
@@ -437,7 +448,7 @@ describe 'host config reports' do
437
448
  end.returns(index_response([report15]))
438
449
 
439
450
  result = run_cmd(['host', 'config-reports', '--name=host.example.com'])
440
- result.exit_code.must_equal HammerCLI::EX_OK
451
+ _(result.exit_code).must_equal HammerCLI::EX_OK
441
452
  end
442
453
 
443
454
  it 'prints error or missing --id and --name' do
@@ -462,7 +473,7 @@ describe 'host config reports' do
462
473
  end.returns(index_response([report15]))
463
474
 
464
475
  result = run_cmd(['host', 'config-reports', '--name=host.example.com', '--search=reported > "2 hour ago"'])
465
- result.exit_code.must_equal HammerCLI::EX_OK
476
+ _(result.exit_code).must_equal HammerCLI::EX_OK
466
477
  end
467
478
  end
468
479
  describe 'disassociate host from vm' do
@@ -491,3 +502,17 @@ describe 'disassociate host from vm' do
491
502
  assert_cmd(expected_result, result)
492
503
  end
493
504
  end
505
+
506
+ describe 'run puppetrun for host' do
507
+ let(:cmd) { ['host', 'puppetrun'] }
508
+ let(:params) { ['--id=1'] }
509
+
510
+ it "does nothing for puppetrun" do
511
+ expected_result = CommandExpectation.new
512
+ expected_result.expected_err = "The puppetrun feature has been removed, however you can use the Remote Execution Plugin to run Puppet commands\n"
513
+ expected_result.expected_exit_code = HammerCLI::EX_SOFTWARE
514
+
515
+ result = run_cmd(cmd)
516
+ assert_cmd(expected_result, result)
517
+ end
518
+ end