hammer_cli_katello 1.6.0 → 1.7.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.rb +1 -1
- data/lib/hammer_cli_katello/content_export_helper.rb +4 -7
- data/lib/hammer_cli_katello/content_import.rb +13 -3
- data/lib/hammer_cli_katello/organization.rb +2 -1
- data/lib/hammer_cli_katello/repository.rb +46 -0
- data/lib/hammer_cli_katello/version.rb +1 -1
- data/test/data/4.6/foreman_api.json +1 -1
- data/test/data/4.7/foreman_api.json +1 -0
- data/test/functional/content_export/complete/repository_test.rb +3 -1
- data/test/functional/content_export/incremental/repository_test.rb +3 -1
- data/test/functional/organization/cdn_configuration_test.rb +1 -0
- data/test/functional/repository/list_test.rb +38 -0
- data/test/functional/repository/remove_content_test.rb +2 -1
- data/test/functional/repository/types_test.rb +120 -0
- data/test/test_helper.rb +1 -1
- metadata +6 -2
@@ -178,7 +178,9 @@ describe 'content-export complete repository' do
|
|
178
178
|
|
179
179
|
it 'Errors out on lazy repositories' do
|
180
180
|
params = ["--id=#{repository_id}"]
|
181
|
-
expects_repository(repository_id, "
|
181
|
+
expects_repository(repository_id, "content_type" => 'yum',
|
182
|
+
"download_policy" => "on_demand",
|
183
|
+
"id" => repository_id)
|
182
184
|
|
183
185
|
ex = api_expects(:content_exports, :repository)
|
184
186
|
ex.returns(response)
|
@@ -189,7 +189,9 @@ describe 'content-export incremental version' do
|
|
189
189
|
|
190
190
|
it 'Errors out on lazy repositories' do
|
191
191
|
params = ["--id=#{repository_id}"]
|
192
|
-
expects_repository(repository_id, "
|
192
|
+
expects_repository(repository_id, "content_type" => 'yum',
|
193
|
+
"download_policy" => "on_demand",
|
194
|
+
"id" => repository_id)
|
193
195
|
|
194
196
|
ex = api_expects(:content_export_incrementals, :repository)
|
195
197
|
ex.returns(response)
|
@@ -65,4 +65,42 @@ ID | NAME | PRODUCT | CONTENT TYPE | URL
|
|
65
65
|
result = run_cmd(@cmd + params)
|
66
66
|
assert_cmd(expected_result, result)
|
67
67
|
end
|
68
|
+
|
69
|
+
it "lists the repositories with a certain repository type" do
|
70
|
+
params = ['--organization-id=1', '--content-type=yum']
|
71
|
+
|
72
|
+
ex = api_expects(:repositories, :index, 'yum repositories list') do |par|
|
73
|
+
par['organization_id'] == org_id && par['page'] == 1 &&
|
74
|
+
par['per_page'] == 1000
|
75
|
+
end
|
76
|
+
|
77
|
+
ex.returns(empty_response)
|
78
|
+
|
79
|
+
expected_result = CommandExpectation.new("---|------|---------|--------------|----
|
80
|
+
ID | NAME | PRODUCT | CONTENT TYPE | URL
|
81
|
+
---|------|---------|--------------|----
|
82
|
+
")
|
83
|
+
|
84
|
+
result = run_cmd(@cmd + params)
|
85
|
+
assert_cmd(expected_result, result)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "lists the repositories with a certain content unit type" do
|
89
|
+
params = ['--organization-id=1', '--with-content=srpm']
|
90
|
+
|
91
|
+
ex = api_expects(:repositories, :index, 'yum repositories list') do |par|
|
92
|
+
par['organization_id'] == org_id && par['page'] == 1 &&
|
93
|
+
par['per_page'] == 1000
|
94
|
+
end
|
95
|
+
|
96
|
+
ex.returns(empty_response)
|
97
|
+
|
98
|
+
expected_result = CommandExpectation.new("---|------|---------|--------------|----
|
99
|
+
ID | NAME | PRODUCT | CONTENT TYPE | URL
|
100
|
+
---|------|---------|--------------|----
|
101
|
+
")
|
102
|
+
|
103
|
+
result = run_cmd(@cmd + params)
|
104
|
+
assert_cmd(expected_result, result)
|
105
|
+
end
|
68
106
|
end
|
@@ -31,7 +31,8 @@ module HammerCLIKatello
|
|
31
31
|
p['id'] == 1 && p['ids'] == %w(20 21 22)
|
32
32
|
end
|
33
33
|
|
34
|
-
run_cmd(%w(repository remove-content --name repo1 --product-id 3 --ids 20,21,22
|
34
|
+
run_cmd(%w(repository remove-content --name repo1 --product-id 3 --ids 20,21,22
|
35
|
+
--content-type rpm))
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -0,0 +1,120 @@
|
|
1
|
+
|
2
|
+
require File.join(File.dirname(__FILE__), '../test_helper')
|
3
|
+
|
4
|
+
describe 'repository types' do
|
5
|
+
before do
|
6
|
+
@cmd = %w(repository types)
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:empty_response) do
|
10
|
+
{
|
11
|
+
"total" => 0,
|
12
|
+
"subtotal" => 0,
|
13
|
+
"page" => "1",
|
14
|
+
"per_page" => "1000",
|
15
|
+
"error" => nil,
|
16
|
+
"search" => nil,
|
17
|
+
"sort" => {
|
18
|
+
"by" => nil,
|
19
|
+
"order" => nil
|
20
|
+
},
|
21
|
+
"results" => []
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
let(:types_response) do
|
26
|
+
{
|
27
|
+
"results" => [
|
28
|
+
{
|
29
|
+
"name": "file",
|
30
|
+
"id": "file",
|
31
|
+
"creatable": true,
|
32
|
+
"pulp3_support": true,
|
33
|
+
"generic_remote_options": [],
|
34
|
+
"import_attributes": [],
|
35
|
+
"url_description": nil,
|
36
|
+
"content_types": [
|
37
|
+
{
|
38
|
+
"label": "file",
|
39
|
+
"generic_browser": nil,
|
40
|
+
"generic": false,
|
41
|
+
"removable": true,
|
42
|
+
"uploadable": true,
|
43
|
+
"indexed": true
|
44
|
+
}
|
45
|
+
]
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"name": "yum",
|
49
|
+
"id": "yum",
|
50
|
+
"creatable": true,
|
51
|
+
"pulp3_support": true,
|
52
|
+
"generic_remote_options": [],
|
53
|
+
"import_attributes": [],
|
54
|
+
"url_description": nil,
|
55
|
+
"content_types": [
|
56
|
+
{
|
57
|
+
"label": "rpm",
|
58
|
+
"generic_browser": nil,
|
59
|
+
"generic": false,
|
60
|
+
"removable": true,
|
61
|
+
"uploadable": true,
|
62
|
+
"indexed": true
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"label": "modulemd",
|
66
|
+
"generic_browser": nil,
|
67
|
+
"generic": false,
|
68
|
+
"removable": false,
|
69
|
+
"uploadable": false,
|
70
|
+
"indexed": true
|
71
|
+
}
|
72
|
+
]
|
73
|
+
}
|
74
|
+
]
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
it "lists repository types and returns empty response" do
|
79
|
+
ex = api_expects(:repositories, :repository_types, 'repository types')
|
80
|
+
|
81
|
+
ex.returns(empty_response)
|
82
|
+
|
83
|
+
expected_result = success_result("\n\n")
|
84
|
+
|
85
|
+
result = run_cmd(@cmd)
|
86
|
+
assert_cmd(expected_result, result)
|
87
|
+
end
|
88
|
+
|
89
|
+
it "lists repository types and returns response" do
|
90
|
+
ex = api_expects(:repositories, :repository_types, 'repository types')
|
91
|
+
|
92
|
+
ex.returns(types_response)
|
93
|
+
# rubocop:disable Style/TrailingWhitespace
|
94
|
+
expected_result = success_result("Name: file
|
95
|
+
Content types:
|
96
|
+
1) Type: file
|
97
|
+
Generic?: false
|
98
|
+
Removable?: true
|
99
|
+
Uploadable?: true
|
100
|
+
Indexed?: true
|
101
|
+
|
102
|
+
Name: yum
|
103
|
+
Content types:
|
104
|
+
1) Type: rpm
|
105
|
+
Generic?: false
|
106
|
+
Removable?: true
|
107
|
+
Uploadable?: true
|
108
|
+
Indexed?: true
|
109
|
+
2) Type: modulemd
|
110
|
+
Generic?: false
|
111
|
+
Removable?: false
|
112
|
+
Uploadable?: false
|
113
|
+
Indexed?: true
|
114
|
+
|
115
|
+
")
|
116
|
+
# rubocop:enable Style/TrailingWhitespace
|
117
|
+
result = run_cmd(@cmd)
|
118
|
+
assert_cmd(expected_result, result)
|
119
|
+
end
|
120
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -17,7 +17,7 @@ require 'minitest/spec'
|
|
17
17
|
require 'mocha/minitest'
|
18
18
|
require 'hammer_cli'
|
19
19
|
|
20
|
-
KATELLO_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '4.
|
20
|
+
KATELLO_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '4.7')
|
21
21
|
|
22
22
|
if HammerCLI.context[:api_connection]
|
23
23
|
HammerCLI.context[:api_connection].create('foreman') do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hammer_cli_katello
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Price
|
@@ -35,7 +35,7 @@ authors:
|
|
35
35
|
autorequire:
|
36
36
|
bindir: bin
|
37
37
|
cert_chain: []
|
38
|
-
date: 2022-
|
38
|
+
date: 2022-11-09 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: hammer_cli_foreman
|
@@ -322,6 +322,7 @@ files:
|
|
322
322
|
- test/data/4.4/foreman_api.json
|
323
323
|
- test/data/4.5/foreman_api.json
|
324
324
|
- test/data/4.6/foreman_api.json
|
325
|
+
- test/data/4.7/foreman_api.json
|
325
326
|
- test/data/Readme.md
|
326
327
|
- test/functional/acs/create_test.rb
|
327
328
|
- test/functional/acs/delete_test.rb
|
@@ -480,6 +481,7 @@ files:
|
|
480
481
|
- test/functional/repository/repository_helpers.rb
|
481
482
|
- test/functional/repository/republish_test.rb
|
482
483
|
- test/functional/repository/synchronize_test.rb
|
484
|
+
- test/functional/repository/types_test.rb
|
483
485
|
- test/functional/repository/update_test.rb
|
484
486
|
- test/functional/repository/upload_test.rb
|
485
487
|
- test/functional/repository_set/available_repositories_test.rb
|
@@ -556,6 +558,7 @@ test_files:
|
|
556
558
|
- test/data/4.4/foreman_api.json
|
557
559
|
- test/data/4.5/foreman_api.json
|
558
560
|
- test/data/4.6/foreman_api.json
|
561
|
+
- test/data/4.7/foreman_api.json
|
559
562
|
- test/data/Readme.md
|
560
563
|
- test/functional/acs/create_test.rb
|
561
564
|
- test/functional/acs/delete_test.rb
|
@@ -714,6 +717,7 @@ test_files:
|
|
714
717
|
- test/functional/repository/repository_helpers.rb
|
715
718
|
- test/functional/repository/republish_test.rb
|
716
719
|
- test/functional/repository/synchronize_test.rb
|
720
|
+
- test/functional/repository/types_test.rb
|
717
721
|
- test/functional/repository/update_test.rb
|
718
722
|
- test/functional/repository/upload_test.rb
|
719
723
|
- test/functional/repository_set/available_repositories_test.rb
|