hammer_cli_katello 1.3.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hammer_cli_katello/content_export_complete.rb +8 -0
- data/lib/hammer_cli_katello/content_export_helper.rb +55 -3
- data/lib/hammer_cli_katello/content_export_incremental.rb +8 -0
- data/lib/hammer_cli_katello/content_import.rb +9 -0
- data/lib/hammer_cli_katello/content_view_component.rb +4 -3
- data/lib/hammer_cli_katello/host_collection.rb +2 -0
- data/lib/hammer_cli_katello/id_resolver.rb +3 -2
- data/lib/hammer_cli_katello/organization.rb +11 -0
- data/lib/hammer_cli_katello/repository.rb +106 -22
- data/lib/hammer_cli_katello/version.rb +1 -1
- metadata +4 -394
- data/test/data/2.5/foreman_api.json +0 -1
- data/test/data/3.0/foreman_api.json +0 -1
- data/test/data/3.10/foreman_api.json +0 -1
- data/test/data/3.11/foreman_api.json +0 -1
- data/test/data/3.12/foreman_api.json +0 -1
- data/test/data/3.13/foreman_api.json +0 -1
- data/test/data/3.14/foreman_api.json +0 -1
- data/test/data/3.15/foreman_api.json +0 -1
- data/test/data/3.16/foreman_api.json +0 -1
- data/test/data/3.17/foreman_api.json +0 -1
- data/test/data/3.18/foreman_api.json +0 -1
- data/test/data/3.19/foreman_api.json +0 -1
- data/test/data/3.2/foreman_api.json +0 -1
- data/test/data/3.4/foreman_api.json +0 -1
- data/test/data/3.5/foreman_api.json +0 -1
- data/test/data/3.6/foreman_api.json +0 -1
- data/test/data/3.7/foreman_api.json +0 -1
- data/test/data/3.8/foreman_api.json +0 -1
- data/test/data/3.9/foreman_api.json +0 -1
- data/test/data/4.0/foreman_api.json +0 -1
- data/test/data/4.1/foreman_api.json +0 -1
- data/test/data/4.3/foreman_api.json +0 -1
- data/test/data/Readme.md +0 -5
- data/test/functional/activation_key/add_host_collection_test.rb +0 -62
- data/test/functional/activation_key/content_override_test.rb +0 -92
- data/test/functional/activation_key/create_test.rb +0 -33
- data/test/functional/activation_key/data/activation_key.json +0 -17
- data/test/functional/activation_key/info_test.rb +0 -29
- data/test/functional/activation_key/list_test.rb +0 -68
- data/test/functional/activation_key/product_content_test.rb +0 -23
- data/test/functional/activation_key/remove_host_collection_test.rb +0 -62
- data/test/functional/activation_key/subscriptions_test.rb +0 -74
- data/test/functional/activation_key/update_test.rb +0 -26
- data/test/functional/apipie_helper_test.rb +0 -31
- data/test/functional/capsule/capsule_helpers.rb +0 -13
- data/test/functional/capsule/content/add_lifecycle_environment_test.rb +0 -40
- data/test/functional/capsule/content/cancel_synchronization_test.rb +0 -42
- data/test/functional/capsule/content/capsule_content_helpers.rb +0 -24
- data/test/functional/capsule/content/data/library_env.json +0 -47
- data/test/functional/capsule/content/data/sync_status.json +0 -6
- data/test/functional/capsule/content/data/sync_tasks.json +0 -62
- data/test/functional/capsule/content/info_test.rb +0 -61
- data/test/functional/capsule/content/lifecycle_environments_test.rb +0 -19
- data/test/functional/capsule/content/remove_lifecycle_environment_test.rb +0 -40
- data/test/functional/capsule/content/synchronization_status_test.rb +0 -107
- data/test/functional/capsule/info_test.rb +0 -25
- data/test/functional/capsule/list_test.rb +0 -24
- data/test/functional/content_credentials/create_test.rb +0 -32
- data/test/functional/content_credentials/data/test_cert.json +0 -43
- data/test/functional/content_credentials/info_test.rb +0 -50
- data/test/functional/content_credentials/list_test.rb +0 -66
- data/test/functional/content_export/complete/library_test.rb +0 -155
- data/test/functional/content_export/complete/version_test.rb +0 -252
- data/test/functional/content_export/content_export_helpers.rb +0 -26
- data/test/functional/content_export/generate_metadata_test.rb +0 -64
- data/test/functional/content_export/incremental/library_test.rb +0 -172
- data/test/functional/content_export/incremental/version_test.rb +0 -268
- data/test/functional/content_export/list_test.rb +0 -64
- data/test/functional/content_import/library_test.rb +0 -85
- data/test/functional/content_import/list_test.rb +0 -65
- data/test/functional/content_import/metadata.json +0 -1
- data/test/functional/content_import/version_test.rb +0 -85
- data/test/functional/content_units/info_test.rb +0 -29
- data/test/functional/content_units/list_test.rb +0 -106
- data/test/functional/content_view/add_content_view_version_test.rb +0 -88
- data/test/functional/content_view/add_repository_test.rb +0 -21
- data/test/functional/content_view/component/add_test.rb +0 -177
- data/test/functional/content_view/component/list_test.rb +0 -55
- data/test/functional/content_view/component/remove_test.rb +0 -107
- data/test/functional/content_view/component/update_test.rb +0 -134
- data/test/functional/content_view/content_view_helpers.rb +0 -20
- data/test/functional/content_view/copy_test.rb +0 -53
- data/test/functional/content_view/create_test.rb +0 -34
- data/test/functional/content_view/delete_test.rb +0 -62
- data/test/functional/content_view/filter/create_test.rb +0 -57
- data/test/functional/content_view/filter/delete_test.rb +0 -90
- data/test/functional/content_view/filter/info_test.rb +0 -89
- data/test/functional/content_view/filter/list_test.rb +0 -98
- data/test/functional/content_view/filter/update_test.rb +0 -91
- data/test/functional/content_view/list_test.rb +0 -68
- data/test/functional/content_view/publish_test.rb +0 -24
- data/test/functional/content_view/purge_test.rb +0 -97
- data/test/functional/content_view/remove_content_view_version_test.rb +0 -88
- data/test/functional/content_view/remove_test.rb +0 -79
- data/test/functional/content_view/update_test.rb +0 -53
- data/test/functional/content_view/version/incremental_update_test.rb +0 -108
- data/test/functional/content_view/version/list_test.rb +0 -44
- data/test/functional/content_view/version/promote_test.rb +0 -75
- data/test/functional/content_view/version/republish_repositories_test.rb +0 -34
- data/test/functional/content_view/version/update_test.rb +0 -48
- data/test/functional/erratum/erratum_helpers.rb +0 -91
- data/test/functional/erratum/info_test.rb +0 -29
- data/test/functional/erratum/list_test.rb +0 -108
- data/test/functional/file/file_helpers.rb +0 -13
- data/test/functional/file/info_test.rb +0 -162
- data/test/functional/file/list_test.rb +0 -112
- data/test/functional/filter_rule/create_test.rb +0 -99
- data/test/functional/filter_rule/delete_test.rb +0 -104
- data/test/functional/filter_rule/filter_rule_helpers.rb +0 -12
- data/test/functional/filter_rule/info_test.rb +0 -104
- data/test/functional/filter_rule/list_test.rb +0 -91
- data/test/functional/filter_rule/update_test.rb +0 -104
- data/test/functional/host/errata/apply_test.rb +0 -45
- data/test/functional/host/errata/info_test.rb +0 -27
- data/test/functional/host/errata/list_test.rb +0 -49
- data/test/functional/host/errata/recalculate_test.rb +0 -26
- data/test/functional/host/extensions/create_test.rb +0 -95
- data/test/functional/host/extensions/data/host.json +0 -320
- data/test/functional/host/extensions/data/host_list.json +0 -117
- data/test/functional/host/extensions/info_test.rb +0 -35
- data/test/functional/host/extensions/list_test.rb +0 -21
- data/test/functional/host/extensions/update_test.rb +0 -70
- data/test/functional/host/host_helpers.rb +0 -8
- data/test/functional/host/subscription/attach_test.rb +0 -54
- data/test/functional/host/subscription/auto_attach_test.rb +0 -35
- data/test/functional/host/subscription/content_override_test.rb +0 -96
- data/test/functional/host/subscription/product_content_test.rb +0 -27
- data/test/functional/host/subscription/register_test.rb +0 -53
- data/test/functional/host/subscription/remove_test.rb +0 -52
- data/test/functional/host/subscription/unregister_test.rb +0 -37
- data/test/functional/host/traces/list_test.rb +0 -37
- data/test/functional/host/traces/resolve_test.rb +0 -31
- data/test/functional/host_collection/add_host_test.rb +0 -90
- data/test/functional/host_collection/content_api_expectations.rb +0 -35
- data/test/functional/host_collection/content_install_test.rb +0 -62
- data/test/functional/host_collection/content_remove_test.rb +0 -37
- data/test/functional/host_collection/content_update_test.rb +0 -37
- data/test/functional/host_collection/copy_test.rb +0 -64
- data/test/functional/host_collection/create_test.rb +0 -54
- data/test/functional/host_collection/delete_test.rb +0 -57
- data/test/functional/host_collection/hosts_test.rb +0 -39
- data/test/functional/host_collection/info_test.rb +0 -57
- data/test/functional/host_collection/list_test.rb +0 -63
- data/test/functional/host_collection/remove_host_test.rb +0 -90
- data/test/functional/host_collection/update_test.rb +0 -57
- data/test/functional/hostgroup/create_test.rb +0 -112
- data/test/functional/hostgroup/data/hostgroup.json +0 -50
- data/test/functional/hostgroup/info_test.rb +0 -33
- data/test/functional/hostgroup/update_test.rb +0 -120
- data/test/functional/lifecycle_environment/create_test.rb +0 -14
- data/test/functional/lifecycle_environment/lifecycle_environment_helpers.rb +0 -18
- data/test/functional/lifecycle_environment/list_test.rb +0 -38
- data/test/functional/lifecycle_environment/update_test.rb +0 -14
- data/test/functional/local_helper_test.rb +0 -30
- data/test/functional/module_stream/info_test.rb +0 -58
- data/test/functional/module_stream/list_test.rb +0 -53
- data/test/functional/organization/cdn_configuration_test.rb +0 -42
- data/test/functional/organization/delete_test.rb +0 -26
- data/test/functional/organization/info_test.rb +0 -39
- data/test/functional/organization/organization_helpers.rb +0 -10
- data/test/functional/package/list_test.rb +0 -160
- data/test/functional/package_group/list_test.rb +0 -38
- data/test/functional/ping_test.rb +0 -61
- data/test/functional/product/create_test.rb +0 -54
- data/test/functional/product/delete_test.rb +0 -41
- data/test/functional/product/info_test.rb +0 -33
- data/test/functional/product/list_test.rb +0 -58
- data/test/functional/product/product_helpers.rb +0 -24
- data/test/functional/product/remove_sync_plan_test.rb +0 -35
- data/test/functional/product/set_sync_plan_test.rb +0 -49
- data/test/functional/product/update_proxy.rb +0 -48
- data/test/functional/product/update_test.rb +0 -46
- data/test/functional/repository/create_test.rb +0 -21
- data/test/functional/repository/delete_test.rb +0 -95
- data/test/functional/repository/info_test.rb +0 -156
- data/test/functional/repository/list_test.rb +0 -68
- data/test/functional/repository/remove_content_test.rb +0 -108
- data/test/functional/repository/repository_helpers.rb +0 -18
- data/test/functional/repository/synchronize_test.rb +0 -57
- data/test/functional/repository/update_test.rb +0 -149
- data/test/functional/repository/upload_test.rb +0 -345
- data/test/functional/repository_set/available_repositories_test.rb +0 -18
- data/test/functional/repository_set/disable_test.rb +0 -42
- data/test/functional/repository_set/enable_test.rb +0 -42
- data/test/functional/repository_set/info_test.rb +0 -17
- data/test/functional/repository_set/list_test.rb +0 -18
- data/test/functional/repository_set/repository_set_helpers.rb +0 -20
- data/test/functional/search_helpers.rb +0 -17
- data/test/functional/simple_content_access/disable_test.rb +0 -48
- data/test/functional/simple_content_access/enable_test.rb +0 -46
- data/test/functional/srpm/list_test.rb +0 -92
- data/test/functional/subscription/list_test.rb +0 -86
- data/test/functional/sync_plan/create_test.rb +0 -60
- data/test/functional/sync_plan/delete_test.rb +0 -46
- data/test/functional/sync_plan/info_test.rb +0 -37
- data/test/functional/sync_plan/list_test.rb +0 -31
- data/test/functional/sync_plan/sync_plan_helpers.rb +0 -8
- data/test/functional/sync_plan/update_test.rb +0 -44
- data/test/functional/test_helper.rb +0 -24
- data/test/task_helper.rb +0 -7
- data/test/test_helper.rb +0 -38
- data/test/unit/id_name_options_validator_test.rb +0 -96
- data/test/unit/id_resolver_test.rb +0 -58
- data/test/unit/messages_test.rb +0 -7
- data/test/unit/search_options_creators_test.rb +0 -145
@@ -1,99 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
require 'hammer_cli_katello/filter_rule'
|
3
|
-
|
4
|
-
module HammerCLIKatello
|
5
|
-
describe FilterRule::CreateCommand do
|
6
|
-
it 'allows minimal options' do
|
7
|
-
api_expects(:content_view_filter_rules, :create) do |p|
|
8
|
-
p['content_view_filter_id'] == 1 && p['name'] == %w(rpm1)
|
9
|
-
end
|
10
|
-
run_cmd(%w(content-view filter rule create --content-view-filter-id 1 --name rpm1))
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'allows multiple package names' do
|
14
|
-
api_expects(:content_view_filter_rules, :create) do |p|
|
15
|
-
p['content_view_filter_id'] == 1 && p['name'] == %w(rpm1 rpm2)
|
16
|
-
end
|
17
|
-
run_cmd(%w(content-view filter rule create --content-view-filter-id 1 --names rpm1,rpm2))
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'allows name resolution of filter with content-view-id' do
|
21
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
22
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
23
|
-
end
|
24
|
-
ex.returns(index_response([{'id' => 1}]))
|
25
|
-
|
26
|
-
api_expects(:content_view_filter_rules, :create) do |p|
|
27
|
-
p['content_view_filter_id'] == 1 && p['name'] == %w(rule9)
|
28
|
-
end
|
29
|
-
run_cmd(%w(content-view filter rule create --content-view-filter cvf1 --content-view-id 3
|
30
|
-
--name rule9))
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'organization' do
|
34
|
-
it 'ID can be specified to resolve content view name' do
|
35
|
-
ex = api_expects(:content_views, :index) do |p|
|
36
|
-
p['name'] == 'cv3' && p['organization_id'] == '6'
|
37
|
-
end
|
38
|
-
ex.returns(index_response([{'id' => 3}]))
|
39
|
-
|
40
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
41
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
42
|
-
end
|
43
|
-
ex.returns(index_response([{'id' => 1}]))
|
44
|
-
|
45
|
-
api_expects(:content_view_filter_rules, :create) do |p|
|
46
|
-
p['content_view_filter_id'] == 1 && p['name'] == %w(rule9)
|
47
|
-
end
|
48
|
-
run_cmd(%w(content-view filter rule create --content-view-filter cvf1 --organization-id 6
|
49
|
-
--content-view cv3 --name rule9))
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'name can be specified to resolve content view name' do
|
53
|
-
ex = api_expects(:organizations, :index) do |p|
|
54
|
-
p[:search] == "name = \"org6\""
|
55
|
-
end
|
56
|
-
ex.returns(index_response([{'id' => 6}]))
|
57
|
-
|
58
|
-
ex = api_expects(:content_views, :index) do |p|
|
59
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
60
|
-
end
|
61
|
-
ex.returns(index_response([{'id' => 3}]))
|
62
|
-
|
63
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
64
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
65
|
-
end
|
66
|
-
ex.returns(index_response([{'id' => 1}]))
|
67
|
-
|
68
|
-
api_expects(:content_view_filter_rules, :create) do |p|
|
69
|
-
p['content_view_filter_id'] == 1 && p['name'] == %w(rule9)
|
70
|
-
end
|
71
|
-
run_cmd(%w(content-view filter rule create --content-view-filter cvf1 --organization org6
|
72
|
-
--content-view cv3 --name rule9))
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'label can be specified to resolve content view name' do
|
76
|
-
ex = api_expects(:organizations, :index) do |p|
|
77
|
-
p[:search] == "label = \"org6\""
|
78
|
-
end
|
79
|
-
ex.returns(index_response([{'id' => 6}]))
|
80
|
-
|
81
|
-
ex = api_expects(:content_views, :index) do |p|
|
82
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
83
|
-
end
|
84
|
-
ex.returns(index_response([{'id' => 3}]))
|
85
|
-
|
86
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
87
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
88
|
-
end
|
89
|
-
ex.returns(index_response([{'id' => 1}]))
|
90
|
-
|
91
|
-
api_expects(:content_view_filter_rules, :create) do |p|
|
92
|
-
p['content_view_filter_id'] == 1 && p['name'] == %w(rule9)
|
93
|
-
end
|
94
|
-
run_cmd(%w(content-view filter rule create --content-view-filter cvf1 --organization-label
|
95
|
-
org6 --content-view cv3 --name rule9))
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
require_relative 'filter_rule_helpers'
|
3
|
-
require 'hammer_cli_katello/filter_rule'
|
4
|
-
|
5
|
-
module HammerCLIKatello
|
6
|
-
describe FilterRule::DeleteCommand do
|
7
|
-
include FilterRuleHelpers
|
8
|
-
|
9
|
-
it 'allows minimal options' do
|
10
|
-
api_expects(:content_view_filter_rules, :destroy) do |p|
|
11
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
12
|
-
end
|
13
|
-
run_cmd(%w(content-view filter rule delete --content-view-filter-id 1 --id 9))
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'resolves rule ID from rule name and filter ID' do
|
17
|
-
expect_filter_rule_search('rule9', 1, 9)
|
18
|
-
|
19
|
-
api_expects(:content_view_filter_rules, :destroy) do |p|
|
20
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
21
|
-
end
|
22
|
-
run_cmd(%w(content-view filter rule delete --content-view-filter-id 1 --name rule9))
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'allows name resolution of filter with content-view-id' do
|
26
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
27
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
28
|
-
end
|
29
|
-
ex.returns(index_response([{'id' => 1}]))
|
30
|
-
|
31
|
-
api_expects(:content_view_filter_rules, :destroy) do |p|
|
32
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
33
|
-
end
|
34
|
-
run_cmd(%w(content-view filter rule delete --content-view-filter cvf1 --content-view-id 3
|
35
|
-
--id 9))
|
36
|
-
end
|
37
|
-
|
38
|
-
describe 'organization' do
|
39
|
-
it 'ID can be specified to resolve content view name' do
|
40
|
-
ex = api_expects(:content_views, :index) do |p|
|
41
|
-
p['name'] == 'cv3' && p['organization_id'] == '6'
|
42
|
-
end
|
43
|
-
ex.returns(index_response([{'id' => 3}]))
|
44
|
-
|
45
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
46
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
47
|
-
end
|
48
|
-
ex.returns(index_response([{'id' => 1}]))
|
49
|
-
|
50
|
-
api_expects(:content_view_filter_rules, :destroy) do |p|
|
51
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
52
|
-
end
|
53
|
-
run_cmd(%w(content-view filter rule delete --content-view-filter cvf1 --organization-id 6
|
54
|
-
--content-view cv3 --id 9))
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'name can be specified to resolve content view name' do
|
58
|
-
ex = api_expects(:organizations, :index) do |p|
|
59
|
-
p[:search] == "name = \"org6\""
|
60
|
-
end
|
61
|
-
ex.returns(index_response([{'id' => 6}]))
|
62
|
-
|
63
|
-
ex = api_expects(:content_views, :index) do |p|
|
64
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
65
|
-
end
|
66
|
-
ex.returns(index_response([{'id' => 3}]))
|
67
|
-
|
68
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
69
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
70
|
-
end
|
71
|
-
ex.returns(index_response([{'id' => 1}]))
|
72
|
-
|
73
|
-
api_expects(:content_view_filter_rules, :destroy) do |p|
|
74
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
75
|
-
end
|
76
|
-
run_cmd(%w(content-view filter rule delete --content-view-filter cvf1 --organization org6
|
77
|
-
--content-view cv3 --id 9))
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'label can be specified to resolve content view name' do
|
81
|
-
ex = api_expects(:organizations, :index) do |p|
|
82
|
-
p[:search] == "label = \"org6\""
|
83
|
-
end
|
84
|
-
ex.returns(index_response([{'id' => 6}]))
|
85
|
-
|
86
|
-
ex = api_expects(:content_views, :index) do |p|
|
87
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
88
|
-
end
|
89
|
-
ex.returns(index_response([{'id' => 3}]))
|
90
|
-
|
91
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
92
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
93
|
-
end
|
94
|
-
ex.returns(index_response([{'id' => 1}]))
|
95
|
-
|
96
|
-
api_expects(:content_view_filter_rules, :destroy) do |p|
|
97
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
98
|
-
end
|
99
|
-
run_cmd(%w(content-view filter rule delete --content-view-filter cvf1 --organization-label
|
100
|
-
org6 --content-view cv3 --id 9))
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require_relative '../search_helpers'
|
2
|
-
|
3
|
-
module FilterRuleHelpers
|
4
|
-
include SearchHelpers
|
5
|
-
|
6
|
-
def expect_filter_rule_search(name, filter_id, return_id)
|
7
|
-
expect_generic_search(
|
8
|
-
:content_view_filter_rules,
|
9
|
-
params: {search: "name = \"#{name}\"", 'content_view_filter_id' => filter_id},
|
10
|
-
returns: {'id' => return_id})
|
11
|
-
end
|
12
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
require_relative 'filter_rule_helpers'
|
3
|
-
require 'hammer_cli_katello/filter_rule'
|
4
|
-
|
5
|
-
module HammerCLIKatello
|
6
|
-
describe FilterRule::InfoCommand do
|
7
|
-
include FilterRuleHelpers
|
8
|
-
|
9
|
-
it 'allows minimal options' do
|
10
|
-
api_expects(:content_view_filter_rules, :show) do |p|
|
11
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
12
|
-
end
|
13
|
-
run_cmd(%w(content-view filter rule info --content-view-filter-id 1 --id 9))
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'resolves rule ID from rule name and filter ID' do
|
17
|
-
expect_filter_rule_search('rule9', 1, 9)
|
18
|
-
|
19
|
-
api_expects(:content_view_filter_rules, :show) do |p|
|
20
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
21
|
-
end
|
22
|
-
run_cmd(%w(content-view filter rule info --content-view-filter-id 1 --name rule9))
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'allows name resolution of filter with content-view-id' do
|
26
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
27
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
28
|
-
end
|
29
|
-
ex.returns(index_response([{'id' => 1}]))
|
30
|
-
|
31
|
-
api_expects(:content_view_filter_rules, :show) do |p|
|
32
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
33
|
-
end
|
34
|
-
run_cmd(%w(content-view filter rule info --content-view-filter cvf1 --content-view-id 3
|
35
|
-
--id 9))
|
36
|
-
end
|
37
|
-
|
38
|
-
describe 'organization' do
|
39
|
-
it 'ID can be specified to resolve content view name' do
|
40
|
-
ex = api_expects(:content_views, :index) do |p|
|
41
|
-
p['name'] == 'cv3' && p['organization_id'] == '6'
|
42
|
-
end
|
43
|
-
ex.returns(index_response([{'id' => 3}]))
|
44
|
-
|
45
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
46
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
47
|
-
end
|
48
|
-
ex.returns(index_response([{'id' => 1}]))
|
49
|
-
|
50
|
-
api_expects(:content_view_filter_rules, :show) do |p|
|
51
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
52
|
-
end
|
53
|
-
run_cmd(%w(content-view filter rule info --content-view-filter cvf1 --organization-id 6
|
54
|
-
--content-view cv3 --id 9))
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'name can be specified to resolve content view name' do
|
58
|
-
ex = api_expects(:organizations, :index) do |p|
|
59
|
-
p[:search] == "name = \"org6\""
|
60
|
-
end
|
61
|
-
ex.returns(index_response([{'id' => 6}]))
|
62
|
-
|
63
|
-
ex = api_expects(:content_views, :index) do |p|
|
64
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
65
|
-
end
|
66
|
-
ex.returns(index_response([{'id' => 3}]))
|
67
|
-
|
68
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
69
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
70
|
-
end
|
71
|
-
ex.returns(index_response([{'id' => 1}]))
|
72
|
-
|
73
|
-
api_expects(:content_view_filter_rules, :show) do |p|
|
74
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
75
|
-
end
|
76
|
-
run_cmd(%w(content-view filter rule info --content-view-filter cvf1 --organization org6
|
77
|
-
--content-view cv3 --id 9))
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'label can be specified to resolve content view name' do
|
81
|
-
ex = api_expects(:organizations, :index) do |p|
|
82
|
-
p[:search] == "label = \"org6\""
|
83
|
-
end
|
84
|
-
ex.returns(index_response([{'id' => 6}]))
|
85
|
-
|
86
|
-
ex = api_expects(:content_views, :index) do |p|
|
87
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
88
|
-
end
|
89
|
-
ex.returns(index_response([{'id' => 3}]))
|
90
|
-
|
91
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
92
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
93
|
-
end
|
94
|
-
ex.returns(index_response([{'id' => 1}]))
|
95
|
-
|
96
|
-
api_expects(:content_view_filter_rules, :show) do |p|
|
97
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
98
|
-
end
|
99
|
-
run_cmd(%w(content-view filter rule info --content-view-filter cvf1 --organization-label
|
100
|
-
org6 --content-view cv3 --id 9))
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
require 'hammer_cli_katello/filter_rule'
|
3
|
-
|
4
|
-
module HammerCLIKatello
|
5
|
-
describe FilterRule::ListCommand do
|
6
|
-
it 'allows minimal options' do
|
7
|
-
api_expects(:content_view_filter_rules, :index) do |p|
|
8
|
-
p['content_view_filter_id'] == 1
|
9
|
-
end
|
10
|
-
run_cmd(%w(content-view filter rule list --content-view-filter-id 1))
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'allows name resolution with content-view-id' do
|
14
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
15
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
16
|
-
end
|
17
|
-
ex.returns(index_response([{'id' => 1}]))
|
18
|
-
|
19
|
-
api_expects(:content_view_filter_rules, :index) do |p|
|
20
|
-
p['content_view_filter_id'] == 1
|
21
|
-
end
|
22
|
-
run_cmd(%w(content-view filter rule list --content-view-filter cvf1 --content-view-id 3))
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'organization' do
|
26
|
-
it 'ID can be specified to resolve content view name' do
|
27
|
-
ex = api_expects(:content_views, :index) do |p|
|
28
|
-
p['name'] == 'cv3' && p['organization_id'] == '6'
|
29
|
-
end
|
30
|
-
ex.returns(index_response([{'id' => 3}]))
|
31
|
-
|
32
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
33
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
34
|
-
end
|
35
|
-
ex.returns(index_response([{'id' => 1}]))
|
36
|
-
|
37
|
-
api_expects(:content_view_filter_rules, :index) do |p|
|
38
|
-
p['content_view_filter_id'] == 1
|
39
|
-
end
|
40
|
-
run_cmd(%w(content-view filter rule list --content-view-filter cvf1 --organization-id 6
|
41
|
-
--content-view cv3))
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'name can be specified to resolve content view name' do
|
45
|
-
ex = api_expects(:organizations, :index) do |p|
|
46
|
-
p[:search] == "name = \"org6\""
|
47
|
-
end
|
48
|
-
ex.returns(index_response([{'id' => 6}]))
|
49
|
-
|
50
|
-
ex = api_expects(:content_views, :index) do |p|
|
51
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
52
|
-
end
|
53
|
-
ex.returns(index_response([{'id' => 3}]))
|
54
|
-
|
55
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
56
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
57
|
-
end
|
58
|
-
ex.returns(index_response([{'id' => 1}]))
|
59
|
-
|
60
|
-
api_expects(:content_view_filter_rules, :index) do |p|
|
61
|
-
p['content_view_filter_id'] == 1
|
62
|
-
end
|
63
|
-
run_cmd(%w(content-view filter rule list --content-view-filter cvf1 --organization org6
|
64
|
-
--content-view cv3))
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'label can be specified to resolve content view name' do
|
68
|
-
ex = api_expects(:organizations, :index) do |p|
|
69
|
-
p[:search] == "label = \"org6\""
|
70
|
-
end
|
71
|
-
ex.returns(index_response([{'id' => 6}]))
|
72
|
-
|
73
|
-
ex = api_expects(:content_views, :index) do |p|
|
74
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
75
|
-
end
|
76
|
-
ex.returns(index_response([{'id' => 3}]))
|
77
|
-
|
78
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
79
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
80
|
-
end
|
81
|
-
ex.returns(index_response([{'id' => 1}]))
|
82
|
-
|
83
|
-
api_expects(:content_view_filter_rules, :index) do |p|
|
84
|
-
p['content_view_filter_id'] == 1
|
85
|
-
end
|
86
|
-
run_cmd(%w(content-view filter rule list --content-view-filter cvf1 --organization-label
|
87
|
-
org6 --content-view cv3))
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
require_relative 'filter_rule_helpers'
|
3
|
-
require 'hammer_cli_katello/filter_rule'
|
4
|
-
|
5
|
-
module HammerCLIKatello
|
6
|
-
describe FilterRule::UpdateCommand do
|
7
|
-
include FilterRuleHelpers
|
8
|
-
|
9
|
-
it 'allows minimal options' do
|
10
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
11
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
12
|
-
end
|
13
|
-
run_cmd(%w(content-view filter rule update --content-view-filter-id 1 --id 9))
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'resolves rule ID from rule name and filter ID' do
|
17
|
-
expect_filter_rule_search('rule9', 1, 9)
|
18
|
-
|
19
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
20
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
21
|
-
end
|
22
|
-
run_cmd(%w(content-view filter rule update --content-view-filter-id 1 --name rule9))
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'allows name resolution of filter with content-view-id' do
|
26
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
27
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
28
|
-
end
|
29
|
-
ex.returns(index_response([{'id' => 1}]))
|
30
|
-
|
31
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
32
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
33
|
-
end
|
34
|
-
run_cmd(%w(content-view filter rule update --content-view-filter cvf1 --content-view-id 3
|
35
|
-
--id 9))
|
36
|
-
end
|
37
|
-
|
38
|
-
describe 'organization' do
|
39
|
-
it 'ID can be specified to resolve content view name' do
|
40
|
-
ex = api_expects(:content_views, :index) do |p|
|
41
|
-
p['name'] == 'cv3' && p['organization_id'] == '6'
|
42
|
-
end
|
43
|
-
ex.returns(index_response([{'id' => 3}]))
|
44
|
-
|
45
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
46
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
47
|
-
end
|
48
|
-
ex.returns(index_response([{'id' => 1}]))
|
49
|
-
|
50
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
51
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
52
|
-
end
|
53
|
-
run_cmd(%w(content-view filter rule update --content-view-filter cvf1 --organization-id 6
|
54
|
-
--content-view cv3 --id 9))
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'name can be specified to resolve content view name' do
|
58
|
-
ex = api_expects(:organizations, :index) do |p|
|
59
|
-
p[:search] == "name = \"org6\""
|
60
|
-
end
|
61
|
-
ex.returns(index_response([{'id' => 6}]))
|
62
|
-
|
63
|
-
ex = api_expects(:content_views, :index) do |p|
|
64
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
65
|
-
end
|
66
|
-
ex.returns(index_response([{'id' => 3}]))
|
67
|
-
|
68
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
69
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
70
|
-
end
|
71
|
-
ex.returns(index_response([{'id' => 1}]))
|
72
|
-
|
73
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
74
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
75
|
-
end
|
76
|
-
run_cmd(%w(content-view filter rule update --content-view-filter cvf1 --organization org6
|
77
|
-
--content-view cv3 --id 9))
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'label can be specified to resolve content view name' do
|
81
|
-
ex = api_expects(:organizations, :index) do |p|
|
82
|
-
p[:search] == "label = \"org6\""
|
83
|
-
end
|
84
|
-
ex.returns(index_response([{'id' => 6}]))
|
85
|
-
|
86
|
-
ex = api_expects(:content_views, :index) do |p|
|
87
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
88
|
-
end
|
89
|
-
ex.returns(index_response([{'id' => 3}]))
|
90
|
-
|
91
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
92
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
93
|
-
end
|
94
|
-
ex.returns(index_response([{'id' => 1}]))
|
95
|
-
|
96
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
97
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
98
|
-
end
|
99
|
-
run_cmd(%w(content-view filter rule update --content-view-filter cvf1 --organization-label
|
100
|
-
org6 --content-view cv3 --id 9))
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
|
-
|
3
|
-
describe 'apply an errata' do
|
4
|
-
include ForemanTaskHelpers
|
5
|
-
|
6
|
-
before do
|
7
|
-
@cmd = %w(host errata apply)
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:errata_id) { "RHEA-1111:1111" }
|
11
|
-
let(:host_id) { 1 }
|
12
|
-
let(:task_id) { '5' }
|
13
|
-
let(:response) do
|
14
|
-
{
|
15
|
-
'id' => task_id,
|
16
|
-
'state' => 'stopped'
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
it "applies an errata to a host" do
|
21
|
-
params = ["--errata-ids=#{errata_id}", "--host-id=#{host_id}"]
|
22
|
-
|
23
|
-
ex = api_expects(:host_errata, :apply, 'Host errata apply') do |par|
|
24
|
-
par['errata_ids'] == [errata_id] && par['host_id'] == host_id
|
25
|
-
end
|
26
|
-
|
27
|
-
ex.returns(response)
|
28
|
-
|
29
|
-
expect_foreman_task(task_id)
|
30
|
-
|
31
|
-
run_cmd(@cmd + params)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "applies an errata to a host with async flag" do
|
35
|
-
params = ["--errata-ids=#{errata_id}", "--host-id=#{host_id}", "--async"]
|
36
|
-
|
37
|
-
ex = api_expects(:host_errata, :apply, 'Host errata apply') do |par|
|
38
|
-
par['errata_ids'] == [errata_id] && par['host_id'] == host_id
|
39
|
-
end
|
40
|
-
|
41
|
-
ex.returns(response)
|
42
|
-
|
43
|
-
run_cmd(@cmd + params)
|
44
|
-
end
|
45
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
|
-
require_relative '../../erratum/erratum_helpers'
|
3
|
-
|
4
|
-
describe 'host Erratum Info' do
|
5
|
-
include ErratumHelpers
|
6
|
-
before do
|
7
|
-
@cmd = %w(host errata info)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "prints module package info on run" do
|
11
|
-
api_expects(:host_errata, :show)
|
12
|
-
.with_params('id' => erratum_id, 'host_id' => host_id)
|
13
|
-
.returns(make_erratum_response)
|
14
|
-
params = ["--id=#{erratum_id}", "--host-id=#{host_id}"]
|
15
|
-
result = run_cmd(@cmd + params)
|
16
|
-
verify_module_packages_and_orphan_packages(result)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "prints package info on run" do
|
20
|
-
api_expects(:host_errata, :show)
|
21
|
-
.with_params('id' => erratum_id, 'host_id' => host_id)
|
22
|
-
.returns(make_erratum_response(true, false))
|
23
|
-
params = ["--id=#{erratum_id}", "--host-id=#{host_id}"]
|
24
|
-
result = run_cmd(@cmd + params)
|
25
|
-
verify_no_modules_packages_with_orphan_packages(result)
|
26
|
-
end
|
27
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
|
-
require_relative '../../lifecycle_environment/lifecycle_environment_helpers'
|
3
|
-
|
4
|
-
describe 'host errata listing' do
|
5
|
-
include LifecycleEnvironmentHelpers
|
6
|
-
|
7
|
-
before do
|
8
|
-
@cmd = %w(host errata list)
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:org_id) { 1 }
|
12
|
-
let(:host_id) { 2 }
|
13
|
-
let(:lifecycle_env_id) { 3 }
|
14
|
-
let(:empty_response) do
|
15
|
-
{
|
16
|
-
"total" => 0,
|
17
|
-
"subtotal" => 0,
|
18
|
-
"page" => "1",
|
19
|
-
"per_page" => "1000",
|
20
|
-
"error" => nil,
|
21
|
-
"search" => nil,
|
22
|
-
"sort" => {
|
23
|
-
"by" => nil,
|
24
|
-
"order" => nil
|
25
|
-
},
|
26
|
-
"results" => []
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
it "lists the host errata belonging to a lifecycle-environment by name" do
|
31
|
-
params = ["--host-id=#{host_id}", "--organization-id=#{org_id}", '--lifecycle-environment=test']
|
32
|
-
|
33
|
-
expect_lifecycle_environment_search(org_id.to_s, 'test', lifecycle_env_id)
|
34
|
-
|
35
|
-
ex = api_expects(:host_errata, :index, 'host errata list').
|
36
|
-
with_params('host_id': host_id,
|
37
|
-
'environment_id': lifecycle_env_id,
|
38
|
-
'page': 1,
|
39
|
-
'per_page': 1000)
|
40
|
-
|
41
|
-
ex.returns(empty_response)
|
42
|
-
expected_result = success_result("---|------------|------|-------|------------
|
43
|
-
ID | ERRATUM ID | TYPE | TITLE | INSTALLABLE
|
44
|
-
---|------------|------|-------|------------
|
45
|
-
")
|
46
|
-
result = run_cmd(@cmd + params)
|
47
|
-
assert_cmd(expected_result, result)
|
48
|
-
end
|
49
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
|
-
|
3
|
-
describe 'recalculate errata' do
|
4
|
-
include ForemanTaskHelpers
|
5
|
-
|
6
|
-
before do
|
7
|
-
@cmd = %w(host errata recalculate)
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:host_id) { 1 }
|
11
|
-
|
12
|
-
it "recalculates errata for a host" do
|
13
|
-
params = ["--host-id=#{host_id}"]
|
14
|
-
|
15
|
-
api_expects(:host_errata, :applicability, 'Host errata recalculate')
|
16
|
-
.with_params('host_id' => host_id)
|
17
|
-
.returns({})
|
18
|
-
|
19
|
-
expected_result = success_result(
|
20
|
-
'Errata recalculation started.
|
21
|
-
'
|
22
|
-
)
|
23
|
-
result = run_cmd(@cmd + params)
|
24
|
-
assert_cmd(expected_result, result)
|
25
|
-
end
|
26
|
-
end
|