hammer_cli_katello 1.0.1 → 1.1.3
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_import.rb +16 -1
- data/lib/hammer_cli_katello/content_view_version.rb +0 -273
- data/lib/hammer_cli_katello/docker.rb +13 -0
- data/lib/hammer_cli_katello/docker_manifest.rb +53 -0
- data/lib/hammer_cli_katello/docker_tag.rb +40 -0
- data/lib/hammer_cli_katello/foreman_search_options_creators.rb +12 -0
- data/lib/hammer_cli_katello/host_collection_erratum.rb +10 -0
- data/lib/hammer_cli_katello/host_collection_package.rb +30 -0
- data/lib/hammer_cli_katello/host_collection_package_group.rb +30 -0
- data/lib/hammer_cli_katello/host_errata.rb +8 -0
- data/lib/hammer_cli_katello/host_package.rb +32 -0
- data/lib/hammer_cli_katello/host_package_group.rb +16 -0
- data/lib/hammer_cli_katello/id_resolver.rb +3 -1
- data/lib/hammer_cli_katello/organization.rb +10 -0
- data/lib/hammer_cli_katello/ping.rb +13 -5
- data/lib/hammer_cli_katello/repository.rb +21 -0
- data/lib/hammer_cli_katello/simple_content_access.rb +2 -0
- data/lib/hammer_cli_katello/version.rb +1 -1
- data/lib/hammer_cli_katello.rb +5 -1
- data/locale/hammer-cli-katello.pot +0 -25
- metadata +7 -419
- data/lib/hammer_cli_katello/cv_import_export_helper.rb +0 -187
- 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/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 -71
- 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 -217
- 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/metadata.json +0 -1
- data/test/functional/content_import/version_test.rb +0 -85
- 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/cv_import_export_helper_test.rb +0 -20
- data/test/functional/content_view/version/default_export_test.rb +0 -40
- data/test/functional/content_view/version/export_test.rb +0 -148
- data/test/functional/content_view/version/import_test.rb +0 -346
- 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 -34
- 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 -40
- 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 -43
- 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/delete_test.rb +0 -26
- data/test/functional/organization/organization_helpers.rb +0 -10
- data/test/functional/package/list_test.rb +0 -158
- data/test/functional/package_group/list_test.rb +0 -38
- data/test/functional/ping_test.rb +0 -20
- 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/export_test.rb +0 -121
- 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,88 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
require_relative '../organization/organization_helpers'
|
3
|
-
require_relative '../content_view/content_view_helpers'
|
4
|
-
require 'hammer_cli_katello/content_view'
|
5
|
-
|
6
|
-
module HammerCLIKatello
|
7
|
-
describe ContentView::RemoveContentViewVersionCommand do
|
8
|
-
include OrganizationHelpers
|
9
|
-
include ContentViewHelpers
|
10
|
-
|
11
|
-
it 'allows minimal options' do
|
12
|
-
ex = api_expects(:content_views, :show) do |p|
|
13
|
-
p[:id] == '1'
|
14
|
-
end
|
15
|
-
ex.returns('id' => 1, 'component_ids' => [1, 3, 6])
|
16
|
-
api_expects(:content_views, :update) do |p|
|
17
|
-
p['id'] == '1' && p['component_ids'] == %w(1 3)
|
18
|
-
end
|
19
|
-
run_cmd(%w(content-view remove-version --id 1 --content-view-version-id 6))
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'resolves content view version ID' do
|
23
|
-
ex = api_expects(:content_view_versions, :index) do |p|
|
24
|
-
p['content_view_id'] == 3 && p['version'] == '2.1'
|
25
|
-
end
|
26
|
-
ex.returns(index_response([{'id' => 6}]))
|
27
|
-
ex.returns('id' => 1, 'component_ids' => [1, 3, 6])
|
28
|
-
ex = api_expects(:content_views, :show) do |p|
|
29
|
-
p[:id] == '1'
|
30
|
-
end
|
31
|
-
ex.returns('id' => 1, 'component_ids' => [1, 3])
|
32
|
-
api_expects(:content_views, :update) do |p|
|
33
|
-
p['id'] == '1' && p['component_ids'] == %w(1 3)
|
34
|
-
end
|
35
|
-
run_cmd(%w(content-view remove-version --id 1 --content-view-id 3 --content-view-version 2.1))
|
36
|
-
end
|
37
|
-
|
38
|
-
describe 'OrganizationOptions' do
|
39
|
-
it 'requires organization if content view name is supplied' do
|
40
|
-
api_expects_no_call
|
41
|
-
result = run_cmd(%w(content-view remove-version --name cv1))
|
42
|
-
assert(result.err[/--organization-id, --organization, --organization-label is required/],
|
43
|
-
"Organization option requirements are validated")
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'allows organization id' do
|
47
|
-
expect_content_view_search('1', 'cv2', 2)
|
48
|
-
ex = api_expects(:content_views, :show) do |p|
|
49
|
-
p[:id] == 2
|
50
|
-
end
|
51
|
-
ex.returns('id' => 2, 'component_ids' => [1, 2, 3])
|
52
|
-
api_expects(:content_views, :update) do |p|
|
53
|
-
p['id'] == 2 && p['component_ids'] == %w(1 2)
|
54
|
-
end
|
55
|
-
run_cmd(%w(content-view remove-version --name cv2 --organization-id 1
|
56
|
-
--content-view-version-id 3))
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'allows organization name' do
|
60
|
-
expect_organization_search('org1', 1)
|
61
|
-
expect_content_view_search(1, 'cv2', 2)
|
62
|
-
ex = api_expects(:content_views, :show) do |p|
|
63
|
-
p[:id] == 2
|
64
|
-
end
|
65
|
-
ex.returns('id' => 2, 'component_ids' => [1, 2, 3])
|
66
|
-
api_expects(:content_views, :update) do |p|
|
67
|
-
p['id'] == 2 && p['component_ids'] == %w(1 2)
|
68
|
-
end
|
69
|
-
run_cmd(%w(content-view remove-version --name cv2 --organization org1
|
70
|
-
--content-view-version-id 3))
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'allows organization label' do
|
74
|
-
expect_organization_search('org1', 1, field: 'label')
|
75
|
-
expect_content_view_search(1, 'cv2', 2)
|
76
|
-
ex = api_expects(:content_views, :show) do |p|
|
77
|
-
p[:id] == 2
|
78
|
-
end
|
79
|
-
ex.returns('id' => 2, 'component_ids' => [1, 2, 3])
|
80
|
-
api_expects(:content_views, :update) do |p|
|
81
|
-
p['id'] == 2 && p['component_ids'] == %w(1 2)
|
82
|
-
end
|
83
|
-
run_cmd(%w(content-view remove-version --name cv2 --organization-label org1
|
84
|
-
--content-view-version-id 3))
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
require 'hammer_cli_katello/content_view'
|
3
|
-
|
4
|
-
module HammerCLIKatello
|
5
|
-
describe ContentView::RemoveCommand do
|
6
|
-
include ForemanTaskHelpers
|
7
|
-
|
8
|
-
describe 'content view version options' do
|
9
|
-
it 'allows removing versions by ID' do
|
10
|
-
ex = api_expects(:content_views, :remove) do |p|
|
11
|
-
p['id'] == 1 && p['content_view_version_ids'] == %w(6 7 8)
|
12
|
-
end
|
13
|
-
ex.returns(id: '9')
|
14
|
-
|
15
|
-
expect_foreman_task('9')
|
16
|
-
|
17
|
-
run_cmd(%w(content-view remove --id 1 --content-view-version-ids 6,7,8))
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'allows removing versions by version number' do
|
21
|
-
versions = %w(6.0 7.0 8.0)
|
22
|
-
ids = [6, 7, 8]
|
23
|
-
|
24
|
-
api_expects(:content_view_versions, :index).with_params(
|
25
|
-
'search' => %(version = "#{versions.join('" or version = "')}"),
|
26
|
-
'content_view_id' => 1
|
27
|
-
).returns(index_response(ids.map { |v| { 'id' => v } }))
|
28
|
-
|
29
|
-
api_expects(:content_views, :remove).with_params(
|
30
|
-
'id' => 1, 'content_view_version_ids' => ids
|
31
|
-
).returns(id: '9')
|
32
|
-
|
33
|
-
expect_foreman_task('9')
|
34
|
-
|
35
|
-
run_cmd(%w(content-view remove --id 1 --content-view-versions 6.0,7.0,8.0))
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'environment options' do
|
40
|
-
it 'allows removing versions by ID' do
|
41
|
-
ex = api_expects(:content_views, :remove) do |p|
|
42
|
-
p['id'] == 1 && p['environment_ids'] == %w(6 7 8)
|
43
|
-
end
|
44
|
-
ex.returns(id: '9')
|
45
|
-
|
46
|
-
expect_foreman_task('9')
|
47
|
-
|
48
|
-
run_cmd(%w(content-view remove --id 1 --environment-ids 6,7,8))
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'requires organization options when removing environments by name' do
|
52
|
-
api_expects_no_call
|
53
|
-
|
54
|
-
run_cmd(%w(content-view remove --id 1 --environments env6,env7,env8))
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'allows removing environments by name' do
|
58
|
-
environment_ids = [6, 7, 8]
|
59
|
-
all_environment_ids = [3, 4, 5, 6, 7, 8]
|
60
|
-
|
61
|
-
ex = api_expects(:lifecycle_environments, :index) do |p|
|
62
|
-
p['organization_id'] == '1'
|
63
|
-
end
|
64
|
-
ex.returns(index_response(all_environment_ids.map do |id|
|
65
|
-
{'id' => id, 'name' => "env#{id}"}
|
66
|
-
end))
|
67
|
-
|
68
|
-
ex = api_expects(:content_views, :remove) do |p|
|
69
|
-
p['id'] == 1 && p['environment_ids'] == environment_ids
|
70
|
-
end
|
71
|
-
ex.returns(id: '9')
|
72
|
-
|
73
|
-
expect_foreman_task('9')
|
74
|
-
|
75
|
-
run_cmd(%w(content-view remove --id 1 --environments env6,env7,env8 --organization-id 1))
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
require_relative '../organization/organization_helpers'
|
3
|
-
require_relative '../content_view/content_view_helpers'
|
4
|
-
require 'hammer_cli_katello/content_view'
|
5
|
-
|
6
|
-
module HammerCLIKatello
|
7
|
-
describe ContentView::UpdateCommand do
|
8
|
-
include OrganizationHelpers
|
9
|
-
include ContentViewHelpers
|
10
|
-
|
11
|
-
it 'allows minimal options' do
|
12
|
-
api_expects(:content_views, :update) do |p|
|
13
|
-
p['id'] == 2
|
14
|
-
end
|
15
|
-
run_cmd(%w(content-view update --id 2))
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'OrganizationOptions' do
|
19
|
-
it 'requires organization if content view name is supplied' do
|
20
|
-
api_expects_no_call
|
21
|
-
result = run_cmd(%w(content-view update --name cv2))
|
22
|
-
assert(result.err[/--organization-id, --organization, --organization-label is required/],
|
23
|
-
"Organization option requirements are validated")
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'allows organization id' do
|
27
|
-
expect_content_view_search('1', 'cv2', 2)
|
28
|
-
api_expects(:content_views, :update) do |p|
|
29
|
-
p['id'] == 2
|
30
|
-
end
|
31
|
-
run_cmd(%w(content-view update --name cv2 --organization-id 1))
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'allows organization name' do
|
35
|
-
expect_organization_search('org1', 1)
|
36
|
-
expect_content_view_search(1, 'cv2', 2)
|
37
|
-
api_expects(:content_views, :update) do |p|
|
38
|
-
p['id'] == 2
|
39
|
-
end
|
40
|
-
run_cmd(%w(content-view update --name cv2 --organization org1))
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'allows organization label' do
|
44
|
-
expect_organization_search('org1', 1, field: 'label')
|
45
|
-
expect_content_view_search(1, 'cv2', 2)
|
46
|
-
api_expects(:content_views, :update) do |p|
|
47
|
-
p['id'] == 2
|
48
|
-
end
|
49
|
-
run_cmd(%w(content-view update --name cv2 --organization-label org1))
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require_relative '../../test_helper'
|
2
|
-
describe 'CVImportExportHelper' do
|
3
|
-
describe 'validate_pulp3_not_enabled' do
|
4
|
-
include HammerCLIKatello::CVImportExportHelper
|
5
|
-
it 'returns true when the api endpoint does not return a value' do
|
6
|
-
api_expects(:content_exports, :api_status)
|
7
|
-
assert_equal true, validate_pulp3_not_enabled('fail_msg')
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'raises error when the api reports Pulp 3 is enabled' do
|
11
|
-
api_expects(:content_exports, :api_status).returns('api_usable' => true)
|
12
|
-
assert_raises(RuntimeError, 'fail msg') { validate_pulp3_not_enabled('fail msg') }
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'returns nil when the api reports Pulp 3 is not enabled' do
|
16
|
-
api_expects(:content_exports, :api_status).returns('api_usable' => false)
|
17
|
-
assert_equal nil, validate_pulp3_not_enabled('fail_msg')
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
|
-
|
3
|
-
describe 'content-view version export' do
|
4
|
-
include ForemanTaskHelpers
|
5
|
-
|
6
|
-
before do
|
7
|
-
@cmd = %w(content-view version export-default)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "performs export with bad SELinux" do
|
11
|
-
params = [
|
12
|
-
'--export-dir=/tmp/default'
|
13
|
-
]
|
14
|
-
|
15
|
-
File.expects(:exist?).with('/usr/share/foreman').returns(true)
|
16
|
-
File.stubs(:exist?).with('/var/log/hammer/hammer.log._copy_').returns(false)
|
17
|
-
|
18
|
-
Dir.expects(:mkdir).with('/tmp/default').returns(0)
|
19
|
-
Kernel.expects(:system).with("rsync -aL /var/lib/pulp/published/yum/https/repos/ /tmp/default")
|
20
|
-
|
21
|
-
result = run_cmd(@cmd + params)
|
22
|
-
assert_equal(HammerCLI::EX_CANTCREAT, result.exit_code)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "performs export" do
|
26
|
-
params = [
|
27
|
-
'--export-dir=/tmp/default'
|
28
|
-
]
|
29
|
-
|
30
|
-
File.expects(:exist?).with('/usr/share/foreman').returns(true)
|
31
|
-
File.stubs(:exist?).with('/var/log/hammer/hammer.log._copy_').returns(false)
|
32
|
-
|
33
|
-
Dir.expects(:exist?).with('/tmp/default').returns(0)
|
34
|
-
Kernel.expects(:system).with("rsync -aL /var/lib/pulp/published/yum/https/repos/ /tmp/default")
|
35
|
-
.returns(true)
|
36
|
-
|
37
|
-
result = run_cmd(@cmd + params)
|
38
|
-
assert_equal(HammerCLI::EX_OK, result.exit_code)
|
39
|
-
end
|
40
|
-
end
|
@@ -1,148 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
|
-
|
3
|
-
describe 'content-view version export' do
|
4
|
-
include ForemanTaskHelpers
|
5
|
-
|
6
|
-
before do
|
7
|
-
@cmd = %w(content-view version export)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "performs export" do
|
11
|
-
HammerCLIKatello::ContentViewVersion::ExportCommand
|
12
|
-
.any_instance
|
13
|
-
.expects(:validate_pulp3_not_enabled)
|
14
|
-
.returns(true)
|
15
|
-
params = [
|
16
|
-
'--id=5',
|
17
|
-
'--export-dir=/tmp/exports'
|
18
|
-
]
|
19
|
-
|
20
|
-
ex = api_expects(:content_view_versions, :show)
|
21
|
-
ex.returns(
|
22
|
-
'id' => '5',
|
23
|
-
'repositories' => [{'id' => '2', 'content_type' => 'yum'}],
|
24
|
-
'major' => 1,
|
25
|
-
'minor' => 0,
|
26
|
-
'content_view' => {'name' => 'cv'},
|
27
|
-
'content_view_id' => 4321
|
28
|
-
)
|
29
|
-
|
30
|
-
ex = api_expects(:content_views, :show)
|
31
|
-
ex.returns(
|
32
|
-
'id' => '4321',
|
33
|
-
'composite' => false,
|
34
|
-
'label' => 'cv'
|
35
|
-
)
|
36
|
-
|
37
|
-
ex = api_expects(:repositories, :show).with_params('id' => '2')
|
38
|
-
ex.returns(
|
39
|
-
'id' => '2',
|
40
|
-
'label' => 'Test_Repo',
|
41
|
-
'content_type' => 'yum',
|
42
|
-
'download_policy' => 'immediate',
|
43
|
-
'backend_identifier' => 'Default_Organization-Library-Test_Repo',
|
44
|
-
'relative_path' => 'Default_Organization/Library/Test_Repo',
|
45
|
-
'library_instance_id' => '1',
|
46
|
-
'content_counts' => {
|
47
|
-
'rpm' => 1,
|
48
|
-
'erratum' => 1
|
49
|
-
}
|
50
|
-
)
|
51
|
-
|
52
|
-
api_expects(:repositories, :show).with_params('id' => '1').returns(
|
53
|
-
'id' => '1',
|
54
|
-
'download_policy' => 'immediate'
|
55
|
-
)
|
56
|
-
api_expects(:packages, :index).returns('results' => [])
|
57
|
-
api_expects(:errata, :index).returns('results' => [])
|
58
|
-
|
59
|
-
File.expects(:exist?).with('/usr/share/foreman').returns(true)
|
60
|
-
File.stubs(:exist?).with('/var/log/hammer/hammer.log._copy_').returns(false)
|
61
|
-
|
62
|
-
Dir.expects(:chdir).with("/var/lib/pulp/published/yum/https/repos/").returns(true)
|
63
|
-
Dir.expects(:mkdir).with('/tmp/exports/export-cv-1.0').returns(0)
|
64
|
-
Dir.expects(:chdir).with('/tmp/exports').returns(0)
|
65
|
-
Dir.expects(:chdir).with('/tmp/exports/export-cv-1.0').returns(0)
|
66
|
-
|
67
|
-
result = run_cmd(@cmd + params)
|
68
|
-
assert_equal(HammerCLI::EX_OK, result.exit_code)
|
69
|
-
end
|
70
|
-
|
71
|
-
it "performs composite export" do
|
72
|
-
HammerCLIKatello::ContentViewVersion::ExportCommand
|
73
|
-
.any_instance
|
74
|
-
.expects(:validate_pulp3_not_enabled)
|
75
|
-
.returns(true)
|
76
|
-
params = [
|
77
|
-
'--id=999',
|
78
|
-
'--export-dir=/tmp/exports'
|
79
|
-
]
|
80
|
-
|
81
|
-
ex = api_expects(:content_view_versions, :show)
|
82
|
-
ex.returns(
|
83
|
-
'id' => '999',
|
84
|
-
'repositories' => [{'id' => '2'}],
|
85
|
-
'major' => 1,
|
86
|
-
'minor' => 0,
|
87
|
-
'content_view' => {'name' => 'cv'},
|
88
|
-
'content_view_id' => 4321
|
89
|
-
)
|
90
|
-
|
91
|
-
ex = api_expects(:content_views, :show)
|
92
|
-
ex.returns(
|
93
|
-
'id' => '4321',
|
94
|
-
'composite' => true,
|
95
|
-
'components' => [{ 'name' => "injera 95.5" }, {'name' => 'carrot wot 87.0'}],
|
96
|
-
'label' => 'cv'
|
97
|
-
)
|
98
|
-
|
99
|
-
File.expects(:exist?).with('/usr/share/foreman').returns(true)
|
100
|
-
File.stubs(:exist?).with('/var/log/hammer/hammer.log._copy_').returns(false)
|
101
|
-
|
102
|
-
Dir.expects(:chdir).with("/var/lib/pulp/published/yum/https/repos/").never
|
103
|
-
Dir.expects(:mkdir).with('/tmp/exports/export-cv-1.0').returns(0)
|
104
|
-
Dir.expects(:chdir).with('/tmp/exports').returns(0)
|
105
|
-
Dir.expects(:chdir).with('/tmp/exports/export-cv-1.0').returns(0)
|
106
|
-
|
107
|
-
result = run_cmd(@cmd + params)
|
108
|
-
assert_equal(HammerCLI::EX_OK, result.exit_code)
|
109
|
-
end
|
110
|
-
|
111
|
-
it "fails export if content view version has no repository" do
|
112
|
-
HammerCLIKatello::ContentViewVersion::ExportCommand
|
113
|
-
.any_instance
|
114
|
-
.expects(:validate_pulp3_not_enabled)
|
115
|
-
.returns(true)
|
116
|
-
params = [
|
117
|
-
'--id=5',
|
118
|
-
'--export-dir=/tmp/exports'
|
119
|
-
]
|
120
|
-
|
121
|
-
ex = api_expects(:content_view_versions, :show)
|
122
|
-
ex.returns(
|
123
|
-
'id' => '5',
|
124
|
-
'name' => 'Test_version',
|
125
|
-
'repositories' => [],
|
126
|
-
'major' => 1,
|
127
|
-
'minor' => 0,
|
128
|
-
'content_view' => {'name' => 'cv'},
|
129
|
-
'content_view_id' => 4321,
|
130
|
-
'puppet_modules' => []
|
131
|
-
)
|
132
|
-
|
133
|
-
ex = api_expects(:content_views, :show)
|
134
|
-
ex.returns(
|
135
|
-
'id' => '4321',
|
136
|
-
'composite' => false
|
137
|
-
)
|
138
|
-
|
139
|
-
File.expects(:exist?).with('/usr/share/foreman').returns(true)
|
140
|
-
File.stubs(:exist?).with('/var/log/hammer/hammer.log._copy_').returns(false)
|
141
|
-
|
142
|
-
result = run_cmd(@cmd + params)
|
143
|
-
assert_equal(result.err, "Could not export the content view:\n"\
|
144
|
-
" Error: Ensure the content view version 'Test_version'"\
|
145
|
-
" has at least one repository.\n")
|
146
|
-
assert_equal(HammerCLI::EX_SOFTWARE, result.exit_code)
|
147
|
-
end
|
148
|
-
end
|