hammer_cli_foreman 2.1.2 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes.md +35 -4
  3. data/doc/testing.md +13 -0
  4. data/lib/hammer_cli_foreman.rb +0 -4
  5. data/lib/hammer_cli_foreman/architecture.rb +5 -5
  6. data/lib/hammer_cli_foreman/associating_commands.rb +4 -5
  7. data/lib/hammer_cli_foreman/auth.rb +4 -4
  8. data/lib/hammer_cli_foreman/bookmark.rb +6 -6
  9. data/lib/hammer_cli_foreman/command_extensions/ping.rb +10 -1
  10. data/lib/hammer_cli_foreman/command_extensions/status.rb +1 -1
  11. data/lib/hammer_cli_foreman/commands.rb +3 -1
  12. data/lib/hammer_cli_foreman/compute_profile.rb +5 -5
  13. data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +1 -0
  14. data/lib/hammer_cli_foreman/config_group.rb +5 -5
  15. data/lib/hammer_cli_foreman/host.rb +3 -2
  16. data/lib/hammer_cli_foreman/hosts/common_update_options.rb +17 -10
  17. data/lib/hammer_cli_foreman/location.rb +2 -0
  18. data/lib/hammer_cli_foreman/mail_notification.rb +2 -2
  19. data/lib/hammer_cli_foreman/model.rb +5 -5
  20. data/lib/hammer_cli_foreman/operating_system.rb +10 -9
  21. data/lib/hammer_cli_foreman/organization.rb +2 -0
  22. data/lib/hammer_cli_foreman/output/fields.rb +1 -1
  23. data/lib/hammer_cli_foreman/output/formatters.rb +1 -1
  24. data/lib/hammer_cli_foreman/ping.rb +20 -11
  25. data/lib/hammer_cli_foreman/references.rb +16 -0
  26. data/lib/hammer_cli_foreman/settings.rb +16 -2
  27. data/lib/hammer_cli_foreman/testing/api_expectations.rb +10 -0
  28. data/lib/hammer_cli_foreman/usergroup.rb +5 -5
  29. data/lib/hammer_cli_foreman/version.rb +1 -1
  30. data/lib/minitest/coverage_reporter.rb +94 -0
  31. data/lib/minitest/hammer_coverage_plugin.rb +19 -0
  32. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  33. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  34. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  35. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  36. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  37. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  38. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  39. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  40. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  41. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  42. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  43. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  44. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  45. data/test/functional/architecture_test.rb +49 -0
  46. data/test/functional/audit_test.rb +86 -63
  47. data/test/functional/bookmark_test.rb +20 -0
  48. data/test/functional/commands/list_test.rb +11 -11
  49. data/test/functional/compute_profile_test.rb +47 -2
  50. data/test/functional/config_group_test.rb +50 -0
  51. data/test/functional/filter_test.rb +114 -47
  52. data/test/functional/host_test.rb +105 -19
  53. data/test/functional/location_test.rb +134 -0
  54. data/test/functional/mail_notification_test.rb +20 -0
  55. data/test/functional/media_test.rb +130 -0
  56. data/test/functional/model_test.rb +50 -0
  57. data/test/functional/operating_system_test.rb +51 -0
  58. data/test/functional/organization_test.rb +52 -0
  59. data/test/functional/realm_test.rb +103 -0
  60. data/test/functional/role_test.rb +9 -12
  61. data/test/functional/settings_test.rb +78 -1
  62. data/test/functional/status_test.rb +79 -13
  63. data/test/functional/user_test.rb +39 -0
  64. data/test/functional/usergroup_test.rb +51 -0
  65. data/test/test_helper.rb +5 -2
  66. data/test/unit/api/interactive_basic_auth_test.rb +3 -1
  67. data/test/unit/api/oauth/oauth_authentication_code_grant_test.rb +2 -2
  68. data/test/unit/api/oauth/oauth_password_grant_test.rb +2 -2
  69. data/test/unit/api_test.rb +3 -4
  70. data/test/unit/apipie_resource_mock.rb +25 -4
  71. data/test/unit/architecture_test.rb +10 -1
  72. data/test/unit/bookmark_test.rb +99 -0
  73. data/test/unit/commands_test.rb +19 -19
  74. data/test/unit/common_parameter_test.rb +1 -1
  75. data/test/unit/compute_profile_test.rb +87 -0
  76. data/test/unit/config_group_test.rb +10 -0
  77. data/test/unit/dependency_resolver_test.rb +4 -4
  78. data/test/unit/exception_handler_test.rb +13 -13
  79. data/test/unit/helpers/command.rb +5 -5
  80. data/test/unit/helpers/resource_disabled.rb +2 -2
  81. data/test/unit/host_test.rb +1 -24
  82. data/test/unit/id_resolver_test.rb +23 -23
  83. data/test/unit/mail_notification_test.rb +53 -0
  84. data/test/unit/media_test.rb +1 -1
  85. data/test/unit/model_test.rb +10 -0
  86. data/test/unit/operating_system_test.rb +14 -1
  87. data/test/unit/option_builders_test.rb +49 -49
  88. data/test/unit/option_sources/id_params_test.rb +2 -2
  89. data/test/unit/option_sources/ids_params_test.rb +2 -2
  90. data/test/unit/output/formatters_test.rb +21 -21
  91. data/test/unit/param_filters_test.rb +17 -17
  92. data/test/unit/partition_table_test.rb +2 -2
  93. data/test/unit/role_test.rb +2 -2
  94. data/test/unit/sessions_test.rb +24 -24
  95. data/test/unit/settings_test.rb +4 -0
  96. data/test/unit/template_test.rb +1 -1
  97. data/test/unit/usergroup_test.rb +10 -0
  98. metadata +26 -7
  99. data/lib/hammer_cli_foreman/trend.rb +0 -47
  100. data/test/functional/trend_test.rb +0 -22
@@ -18,6 +18,8 @@ describe HammerCLIForeman::Settings do
18
18
  context "parameters" do
19
19
  it_should_accept "no arguments"
20
20
  it_should_accept_search_params
21
+ it_should_fail_with 'organization param', ['--organization-id=1']
22
+ it_should_fail_with 'location param', ['--location-id=1']
21
23
  end
22
24
 
23
25
  context "output" do
@@ -38,6 +40,8 @@ describe HammerCLIForeman::Settings do
38
40
  context "parameters" do
39
41
  it_should_accept "name", ["--name=setting1", "--value=setting2"]
40
42
  it_should_accept "id", ["--id=1", "--value=setting2"]
43
+ it_should_fail_with 'organization param', ['--organization-id=1']
44
+ it_should_fail_with 'location param', ['--location-id=1']
41
45
  end
42
46
 
43
47
  end
@@ -45,7 +45,7 @@ describe HammerCLIForeman::Template do
45
45
  }
46
46
  }
47
47
  ResourceMocks.mock_action_call(:provisioning_templates, :show, template_wo_kind)
48
- cmd.run([]).must_equal 0
48
+ _(cmd.run([])).must_equal 0
49
49
  end
50
50
  end
51
51
 
@@ -18,6 +18,8 @@ describe HammerCLIForeman::Usergroup do
18
18
  context "parameters" do
19
19
  it_should_accept "no arguments"
20
20
  it_should_accept_search_params
21
+ it_should_fail_with 'organization param', ['--organization-id=1']
22
+ it_should_fail_with 'location param', ['--location-id=1']
21
23
  end
22
24
 
23
25
  context "output" do
@@ -35,6 +37,8 @@ describe HammerCLIForeman::Usergroup do
35
37
  context "parameters" do
36
38
  it_should_accept "id", ["--id=1"]
37
39
  it_should_accept "name", ["--name=ug"]
40
+ it_should_fail_with 'organization param', ['--organization-id=1']
41
+ it_should_fail_with 'location param', ['--location-id=1']
38
42
  end
39
43
 
40
44
  context "output" do
@@ -58,6 +62,8 @@ describe HammerCLIForeman::Usergroup do
58
62
  context "parameters" do
59
63
  it_should_accept "name", ["--name=ug"]
60
64
  it_should_accept "name, role ids, user group ids and user ids", ["--name=ug", "--role-ids=1,2,3", "--user-group-ids=1,2,3", "--user-ids=1,2,3"]
65
+ it_should_fail_with 'organization param', ['--organization-id=1']
66
+ it_should_fail_with 'location param', ['--location-id=1']
61
67
  end
62
68
  end
63
69
 
@@ -68,6 +74,8 @@ describe HammerCLIForeman::Usergroup do
68
74
  context "parameters" do
69
75
  it_should_accept "name", ["--name=ug"]
70
76
  it_should_accept "id", ["--id=1"]
77
+ it_should_fail_with 'organization param', ['--organization-id=1']
78
+ it_should_fail_with 'location param', ['--location-id=1']
71
79
  end
72
80
  end
73
81
 
@@ -80,6 +88,8 @@ describe HammerCLIForeman::Usergroup do
80
88
  it_should_accept "id", ["--id=1"]
81
89
  it_should_accept "name and new name", ["--name=ug", "--new-name=ug2"]
82
90
  it_should_accept "id, new name, role ids, user group ids and user ids", ["--id=1", "--new-name=ug", "--role-ids=1,2,3", "--user-group-ids=1,2,3", "--user-ids=1,2,3"]
91
+ it_should_fail_with 'organization param', ['--organization-id=1']
92
+ it_should_fail_with 'location param', ['--location-id=1']
83
93
  end
84
94
  end
85
95
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomáš Strachota
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-14 00:00:00.000000000 Z
12
+ date: 2021-02-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hammer_cli
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 2.1.0
20
+ version: 2.4.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 2.1.0
27
+ version: 2.4.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: apipie-bindings
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -211,12 +211,13 @@ files:
211
211
  - lib/hammer_cli_foreman/task_helper.rb
212
212
  - lib/hammer_cli_foreman/template.rb
213
213
  - lib/hammer_cli_foreman/testing/api_expectations.rb
214
- - lib/hammer_cli_foreman/trend.rb
215
214
  - lib/hammer_cli_foreman/user.rb
216
215
  - lib/hammer_cli_foreman/user_mail_notification.rb
217
216
  - lib/hammer_cli_foreman/usergroup.rb
218
217
  - lib/hammer_cli_foreman/version.rb
219
218
  - lib/hammer_cli_foreman/virtual_machine.rb
219
+ - lib/minitest/coverage_reporter.rb
220
+ - lib/minitest/hammer_coverage_plugin.rb
220
221
  - locale/ca/LC_MESSAGES/hammer-cli-foreman.mo
221
222
  - locale/de/LC_MESSAGES/hammer-cli-foreman.mo
222
223
  - locale/en/LC_MESSAGES/hammer-cli-foreman.mo
@@ -245,6 +246,7 @@ files:
245
246
  - test/data/2.0/foreman_api.json
246
247
  - test/data/2.1/foreman_api.json
247
248
  - test/data/README.md
249
+ - test/functional/architecture_test.rb
248
250
  - test/functional/associating_commands_test.rb
249
251
  - test/functional/audit_test.rb
250
252
  - test/functional/auth_source_test.rb
@@ -253,6 +255,7 @@ files:
253
255
  - test/functional/compute_attribute_test.rb
254
256
  - test/functional/compute_profile_test.rb
255
257
  - test/functional/compute_resource_test.rb
258
+ - test/functional/config_group_test.rb
256
259
  - test/functional/filter_test.rb
257
260
  - test/functional/host_test.rb
258
261
  - test/functional/hostgroup/create_test.rb
@@ -260,10 +263,14 @@ files:
260
263
  - test/functional/http_proxy_test.rb
261
264
  - test/functional/location_test.rb
262
265
  - test/functional/mail_notification_test.rb
266
+ - test/functional/media_test.rb
267
+ - test/functional/model_test.rb
268
+ - test/functional/operating_system_test.rb
263
269
  - test/functional/organization_test.rb
264
270
  - test/functional/personal_access_token_test.rb
265
271
  - test/functional/ping_test.rb
266
272
  - test/functional/proxy_test.rb
273
+ - test/functional/realm_test.rb
267
274
  - test/functional/report_template_test.rb
268
275
  - test/functional/role_test.rb
269
276
  - test/functional/settings_test.rb
@@ -274,9 +281,9 @@ files:
274
281
  - test/functional/subnet/update_test.rb
275
282
  - test/functional/template_test.rb
276
283
  - test/functional/test_helper.rb
277
- - test/functional/trend_test.rb
278
284
  - test/functional/user_mail_notification_test.rb
279
285
  - test/functional/user_test.rb
286
+ - test/functional/usergroup_test.rb
280
287
  - test/functional/virtual_machine_test.rb
281
288
  - test/reports/TEST-Minitest-Result.xml
282
289
  - test/test_helper.rb
@@ -291,8 +298,10 @@ files:
291
298
  - test/unit/audit_test.rb
292
299
  - test/unit/auth_source_external.rb
293
300
  - test/unit/auth_source_ldap_test.rb
301
+ - test/unit/bookmark_test.rb
294
302
  - test/unit/commands_test.rb
295
303
  - test/unit/common_parameter_test.rb
304
+ - test/unit/compute_profile_test.rb
296
305
  - test/unit/compute_resource_test.rb
297
306
  - test/unit/config_group_test.rb
298
307
  - test/unit/config_report_test.rb
@@ -312,6 +321,7 @@ files:
312
321
  - test/unit/id_resolver_test.rb
313
322
  - test/unit/image_test.rb
314
323
  - test/unit/location_test.rb
324
+ - test/unit/mail_notification_test.rb
315
325
  - test/unit/media_test.rb
316
326
  - test/unit/messages_test.rb
317
327
  - test/unit/model_test.rb
@@ -383,6 +393,7 @@ test_files:
383
393
  - test/unit/auth_source_ldap_test.rb
384
394
  - test/unit/audit_test.rb
385
395
  - test/unit/test_helper.rb
396
+ - test/unit/mail_notification_test.rb
386
397
  - test/unit/smart_class_parameter_test.rb
387
398
  - test/unit/partition_table_test.rb
388
399
  - test/unit/operating_system_test.rb
@@ -411,6 +422,7 @@ test_files:
411
422
  - test/unit/filter_test.rb
412
423
  - test/unit/puppet_environment_test.rb
413
424
  - test/unit/output/formatters_test.rb
425
+ - test/unit/compute_profile_test.rb
414
426
  - test/unit/host_test.rb
415
427
  - test/unit/config_report_test.rb
416
428
  - test/unit/fact_test.rb
@@ -418,6 +430,7 @@ test_files:
418
430
  - test/unit/commands_test.rb
419
431
  - test/unit/common_parameter_test.rb
420
432
  - test/unit/subnet_test.rb
433
+ - test/unit/bookmark_test.rb
421
434
  - test/data/2.1/foreman_api.json
422
435
  - test/data/2.0/foreman_api.json
423
436
  - test/data/1.24/foreman_api.json
@@ -436,13 +449,19 @@ test_files:
436
449
  - test/functional/http_proxy_test.rb
437
450
  - test/functional/commands/list_test.rb
438
451
  - test/functional/user_mail_notification_test.rb
452
+ - test/functional/config_group_test.rb
439
453
  - test/functional/user_test.rb
454
+ - test/functional/realm_test.rb
440
455
  - test/functional/personal_access_token_test.rb
441
456
  - test/functional/audit_test.rb
442
457
  - test/functional/test_helper.rb
443
458
  - test/functional/mail_notification_test.rb
444
459
  - test/functional/ping_test.rb
445
460
  - test/functional/smart_class_parameter_test.rb
461
+ - test/functional/operating_system_test.rb
462
+ - test/functional/media_test.rb
463
+ - test/functional/architecture_test.rb
464
+ - test/functional/usergroup_test.rb
446
465
  - test/functional/role_test.rb
447
466
  - test/functional/location_test.rb
448
467
  - test/functional/hostgroup/create_test.rb
@@ -453,10 +472,10 @@ test_files:
453
472
  - test/functional/settings_test.rb
454
473
  - test/functional/template_test.rb
455
474
  - test/functional/proxy_test.rb
475
+ - test/functional/model_test.rb
456
476
  - test/functional/compute_resource_test.rb
457
477
  - test/functional/compute_attribute_test.rb
458
478
  - test/functional/filter_test.rb
459
- - test/functional/trend_test.rb
460
479
  - test/functional/report_template_test.rb
461
480
  - test/functional/compute_profile_test.rb
462
481
  - test/functional/host_test.rb
@@ -1,47 +0,0 @@
1
- module HammerCLIForeman
2
-
3
- class Trend < HammerCLIForeman::Command
4
-
5
- resource :trends
6
-
7
- class ListCommand < HammerCLIForeman::ListCommand
8
- output do
9
- field :id, _("Id")
10
- field :name, _("Name")
11
- field :label, _("Label")
12
- end
13
-
14
- build_options
15
- end
16
-
17
- class CreateCommand < HammerCLIForeman::CreateCommand
18
- success_message _("Trend for %<trendable_type>s created.")
19
- failure_message _("Could not create the trend")
20
-
21
- build_options
22
- end
23
-
24
- class DeleteCommand < HammerCLIForeman::DeleteCommand
25
- success_message _("Trend for %<trendable_type>s deleted.")
26
- failure_message _("Could not delete the trend")
27
-
28
- build_options
29
- end
30
-
31
- class InfoCommand < HammerCLIForeman::InfoCommand
32
- output do
33
- field :id, _('Id')
34
- field :name, _('Name')
35
- field :label, _("Label")
36
- field :trendable_type, _('Type')
37
- HammerCLIForeman::References.taxonomies(self)
38
- HammerCLIForeman::References.timestamps(self)
39
- end
40
-
41
- build_options
42
- end
43
-
44
- autoload_subcommands
45
- end
46
- end
47
-
@@ -1,22 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'test_helper')
2
-
3
- describe 'trend' do
4
- describe 'list' do
5
- before do
6
- @cmd = %w(trend list)
7
- @trends =
8
- [{
9
- id: 1,
10
- label: "Operatingsystem",
11
- trendable_type: "Operatingsystem",
12
- name: "os_trend" }]
13
- end
14
-
15
- it 'should return a list of trends' do
16
- api_expects(:trends, :index, 'List trends').returns(@trends)
17
-
18
- result = run_cmd(@cmd)
19
- result.exit_code.must_equal HammerCLI::EX_OK
20
- end
21
- end
22
- end