hammer_cli_katello 0.21.0 → 0.23.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,9 @@ describe 'ping' do
8
8
  'foreman_tasks' => {'status' => 'ok', 'duration_ms' => '34'},
9
9
  'foreman_auth' => {'status' => 'ok', 'duration_ms' => '34'},
10
10
  'candlepin' => {'status' => 'ok', 'duration_ms' => '34'},
11
+ 'candlepin_events' => {'status' => 'ok', 'message' => '0 messages', 'duration_ms' => '34'},
11
12
  'candlepin_auth' => {'status' => 'ok', 'duration_ms' => '34'},
13
+ 'katello_events' => {'status' => 'ok', 'message' => '0 messages', 'duration_ms' => '34'},
12
14
  'pulp' => {'status' => 'ok', 'duration_ms' => '34'},
13
15
  'pulp_auth' => {'status' => 'ok', 'duration_ms' => '34'}
14
16
  }
@@ -48,36 +48,4 @@ describe "create repository" do
48
48
 
49
49
  assert_equal(0, run_cmd(command).exit_code)
50
50
  end
51
-
52
- it 'shows deprecation warning on puppet content type' do
53
- dep_warning = "Puppet and OSTree will no longer be supported in Katello 3.16\nRepository created.\n" # rubocop:disable LineLength
54
-
55
- api_expects(:repositories, :create)
56
- .with_params(
57
- name: name,
58
- product_id: product_id,
59
- content_type: "puppet")
60
-
61
- result = run_cmd(%w(repository create --organization-id 1 --product-id 2
62
- --content-type puppet --name repo1))
63
-
64
- assert_equal(dep_warning, result.out)
65
- assert_equal(HammerCLI::EX_OK, result.exit_code)
66
- end
67
-
68
- it 'shows deprecation warning on ostree content type' do
69
- dep_warning = "Puppet and OSTree will no longer be supported in Katello 3.16\nRepository created.\n" # rubocop:disable LineLength
70
-
71
- api_expects(:repositories, :create)
72
- .with_params(
73
- name: name,
74
- product_id: product_id,
75
- content_type: "ostree")
76
-
77
- result = run_cmd(%w(repository create --organization-id 1 --product-id 2
78
- --content-type ostree --name repo1))
79
-
80
- assert_equal(dep_warning, result.out)
81
- assert_equal(HammerCLI::EX_OK, result.exit_code)
82
- end
83
51
  end
@@ -1,6 +1,7 @@
1
1
  require File.join(File.dirname(__FILE__), '../test_helper')
2
2
  require File.join(File.dirname(__FILE__), '../product/product_helpers')
3
3
  require File.join(File.dirname(__FILE__), './repository_helpers')
4
+ require 'hammer_cli_katello/associating_commands'
4
5
 
5
6
  describe "get repository info" do
6
7
  include ProductHelpers
@@ -10,37 +11,146 @@ describe "get repository info" do
10
11
  @cmd = %w(repository info)
11
12
  end
12
13
 
13
- let(:org_id) { 1 }
14
- let(:product_id) { 2 }
15
- let(:repo_id) { 3 }
16
-
17
- it "Shows information about a repository" do
18
- params = ["--id=#{repo_id}"]
19
-
20
- ex = api_expects(:repositories, :show, "Get info") do |par|
21
- par["id"] == repo_id
22
- end
23
-
24
- ex.returns({})
25
-
14
+ it "shows repository info by id" do
15
+ params = ['--id=1']
16
+ ex = api_expects(:repositories, :show, "Get info")
17
+ ex.returns(
18
+ 'id' => 1,
19
+ 'name' => 'Test Repo',
20
+ 'label' => 'Test_Repo',
21
+ 'description' => 'hammertime',
22
+ 'organization' => {
23
+ 'name' => 'Default Organization',
24
+ 'label' => 'Default_Organization',
25
+ 'id' => 1
26
+ },
27
+ 'created_at' => '2020-08-05 15:35:36 UTC',
28
+ 'updated_at' => '2020-08-05 15:35:36 UTC',
29
+ 'content_type' => 'yum',
30
+ 'product' => {
31
+ 'id' => 79,
32
+ 'name' => 'test'
33
+ },
34
+ 'download_policy' => 'immediate',
35
+ 'unprotected' => true,
36
+ 'last_sync_words' => '3 minutes',
37
+ 'mirror_on_sync' => true,
38
+ 'relative_path' => 'Default_Organization/Library/Test_Repo',
39
+ 'content_counts' => {
40
+ 'rpm' => 1,
41
+ 'srpm' => 0,
42
+ 'package_group' => 0,
43
+ 'erratum' => 1,
44
+ 'module_stream' => 0
45
+ }
46
+ )
26
47
  result = run_cmd(@cmd + params)
27
- assert_equal(result.exit_code, 0)
48
+ # rubocop:disable Style/WordArray
49
+ expected_fields = [['ID', '1'],
50
+ ['Name', 'Test Repo'],
51
+ ['Label', 'Test_Repo'],
52
+ ['Description', 'hammertime'],
53
+ ['Organization', 'Default Organization'],
54
+ ['Red Hat Repository', 'no'],
55
+ ['Content Type', 'yum'],
56
+ ['Mirror on Sync', 'yes'],
57
+ ['Publish Via HTTP', 'yes'],
58
+ ['Relative Path', 'Default_Organization/Library/Test_Repo'],
59
+ ['Download Policy', 'immediate'],
60
+ ['HTTP Proxy', ''],
61
+ ['Product', ''],
62
+ ['ID', '79'],
63
+ ['Name', 'test'],
64
+ ['GPG Key', ''],
65
+ ['Sync', ''],
66
+ ['Status', 'Not Synced'],
67
+ ['Last Sync Date', '3 minutes'],
68
+ ['Created', '2020/08/05 15:35:36'],
69
+ ['Updated', '2020/08/05 15:35:36'],
70
+ ['Content Counts', ''],
71
+ ['Packages', '1'],
72
+ ['Source RPMS', '0'],
73
+ ['Package Groups', '0'],
74
+ ['Errata', '1'],
75
+ ['Module Streams', '0']]
76
+ # rubocop:enable Style/WordArray
77
+ expected_results = expected_fields.map { |field| success_result(FieldMatcher.new(*field)) }
78
+ expected_results.each { |expected| assert_cmd(expected, result) }
28
79
  end
29
80
 
30
81
  it "Shows information about a repository with organization-id and product name" do
31
- params = ["--name=test_repo", "--product=test_product", "--organization-id=#{org_id}"]
32
-
33
- expect_product_search(org_id, 'test_product', product_id)
82
+ org_id = 1
83
+ product_id = 2
84
+ repo_id = 3
85
+ params = ["--name=Test_Repo", "--product=Test_Product", "--organization-id=1"]
34
86
 
35
- expect_repository_search(product_id, 'test_repo', repo_id)
87
+ expect_product_search(org_id, 'Test_Product', product_id)
36
88
 
37
- ex2 = api_expects(:repositories, :show, "Get info") do |par|
38
- par["id"] == repo_id
39
- end
89
+ expect_repository_search(product_id, 'Test_Repo', repo_id)
40
90
 
41
- ex2.returns({})
91
+ ex = api_expects(:repositories, :show, "Get info")
42
92
 
93
+ ex.returns(
94
+ 'id' => 1,
95
+ 'name' => 'Test Repo',
96
+ 'label' => 'Test_Repo',
97
+ 'description' => 'hammertime',
98
+ 'organization' => {
99
+ 'name' => 'Default Organization',
100
+ 'label' => 'Default_Organization',
101
+ 'id' => 1
102
+ },
103
+ 'created_at' => '2020-08-05 15:35:36 UTC',
104
+ 'updated_at' => '2020-08-05 15:35:36 UTC',
105
+ 'content_type' => 'yum',
106
+ 'product' => {
107
+ 'id' => 79,
108
+ 'name' => 'Test_Product'
109
+ },
110
+ 'download_policy' => 'immediate',
111
+ 'unprotected' => true,
112
+ 'last_sync_words' => '3 minutes',
113
+ 'mirror_on_sync' => true,
114
+ 'relative_path' => 'Default_Organization/Library/Test_Repo',
115
+ 'content_counts' => {
116
+ 'rpm' => 1,
117
+ 'srpm' => 0,
118
+ 'package_group' => 0,
119
+ 'erratum' => 1,
120
+ 'module_stream' => 0
121
+ }
122
+ )
43
123
  result = run_cmd(@cmd + params)
44
- assert_equal(result.exit_code, 0)
124
+ # rubocop:disable Style/WordArray
125
+ expected_fields = [['ID', '1'],
126
+ ['Name', 'Test Repo'],
127
+ ['Label', 'Test_Repo'],
128
+ ['Description', 'hammertime'],
129
+ ['Organization', 'Default Organization'],
130
+ ['Red Hat Repository', 'no'],
131
+ ['Content Type', 'yum'],
132
+ ['Mirror on Sync', 'yes'],
133
+ ['Publish Via HTTP', 'yes'],
134
+ ['Relative Path', 'Default_Organization/Library/Test_Repo'],
135
+ ['Download Policy', 'immediate'],
136
+ ['HTTP Proxy', ''],
137
+ ['Product', ''],
138
+ ['ID', '79'],
139
+ ['Name', 'Test_Product'],
140
+ ['GPG Key', ''],
141
+ ['Sync', ''],
142
+ ['Status', 'Not Synced'],
143
+ ['Last Sync Date', '3 minutes'],
144
+ ['Created', '2020/08/05 15:35:36'],
145
+ ['Updated', '2020/08/05 15:35:36'],
146
+ ['Content Counts', ''],
147
+ ['Packages', '1'],
148
+ ['Source RPMS', '0'],
149
+ ['Package Groups', '0'],
150
+ ['Errata', '1'],
151
+ ['Module Streams', '0']]
152
+ # rubocop:enable Style/WordArray
153
+ expected_results = expected_fields.map { |field| success_result(FieldMatcher.new(*field)) }
154
+ expected_results.each { |expected| assert_cmd(expected, result) }
45
155
  end
46
156
  end
@@ -2,7 +2,7 @@ require_relative '../test_helper'
2
2
  require_relative '../organization/organization_helpers'
3
3
  require 'hammer_cli_katello/repository'
4
4
 
5
- module HammerCLIKatello
5
+ module HammerCLIKatello # rubocop:disable Metrics/ModuleLength
6
6
  describe Repository::UpdateCommand do
7
7
  include OrganizationHelpers
8
8
 
@@ -14,6 +14,46 @@ module HammerCLIKatello
14
14
  run_cmd(%w(repository update --id 1 --new-name rep1))
15
15
  end
16
16
 
17
+ describe 'tags docker images' do
18
+ let(:repo_id) { 3 }
19
+ let(:tag_name) { "latest" }
20
+ let(:digest) { "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }
21
+ let(:upload_id) { "1234" }
22
+ let(:_href) { "/pulp/api/v2/content/uploads/#{upload_id}" }
23
+ let(:upload_response) do
24
+ {
25
+ "upload_id" => upload_id,
26
+ "_href" => _href
27
+ }
28
+ end
29
+ it "adds a tag to an image" do
30
+ ex = api_expects(:content_uploads, :create)
31
+ .with_params('repository_id' => repo_id, :size => 0)
32
+
33
+ ex.returns(upload_response)
34
+ ex2 = api_expects(:repositories, :import_uploads, 'Take in an upload')
35
+ .with_params(:id => repo_id, :sync_capsule => true, :publish_repository => true,
36
+ :uploads => [{
37
+ :id => '1234',
38
+ :name => tag_name,
39
+ :digest => digest
40
+ }],
41
+ :content_type => "docker_tag"
42
+ )
43
+
44
+ ex2.returns("")
45
+
46
+ ex3 = api_expects(:content_uploads, :destroy, "Delete the upload")
47
+ .with_params('id' => upload_id, 'repository_id' => repo_id)
48
+
49
+ ex3.returns("")
50
+ # rubocop:disable LineLength
51
+ result = run_cmd(%W(repository update --id #{repo_id} --docker-tag #{tag_name} --docker-digest #{digest}))
52
+ # rubocop:enable LineLength
53
+ assert_equal(result.exit_code, 0)
54
+ end
55
+ end
56
+
17
57
  describe 'resolves repository ID' do
18
58
  it 'by requiring product' do
19
59
  api_expects_no_call
@@ -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'] || '3.15')
20
+ KATELLO_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '3.17')
21
21
 
22
22
  if HammerCLI.context[:api_connection]
23
23
  HammerCLI.context[:api_connection].create('foreman') do
@@ -110,6 +110,12 @@ describe HammerCLIKatello::SearchOptionsCreators do
110
110
  end
111
111
  end
112
112
 
113
+ describe '#create_usergroups_search_options(options)' do
114
+ it 'does not use the katello api' do
115
+ search_options_creators.create_usergroups_search_options(:anything)
116
+ end
117
+ end
118
+
113
119
  describe '#create_compute_profiles_search_options(options, mode = nil)' do
114
120
  it 'does not use the katello api' do
115
121
  search_options_creators.create_compute_profiles_search_options(:anything)
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: 0.21.0
4
+ version: 0.23.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Price
@@ -35,22 +35,22 @@ authors:
35
35
  autorequire:
36
36
  bindir: bin
37
37
  cert_chain: []
38
- date: 2020-02-25 00:00:00.000000000 Z
38
+ date: 2020-09-21 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: hammer_cli_foreman
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 2.0.0
46
+ version: '0'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 2.0.0
53
+ version: '0'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: hammer_cli_foreman_tasks
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -248,6 +248,7 @@ files:
248
248
  - lib/hammer_cli_katello/content_view_purge.rb
249
249
  - lib/hammer_cli_katello/content_view_version.rb
250
250
  - lib/hammer_cli_katello/cv_import_export_helper.rb
251
+ - lib/hammer_cli_katello/deb_package.rb
251
252
  - lib/hammer_cli_katello/erratum.rb
252
253
  - lib/hammer_cli_katello/erratum_info_command.rb
253
254
  - lib/hammer_cli_katello/exception_handler.rb
@@ -262,12 +263,14 @@ files:
262
263
  - lib/hammer_cli_katello/host_collection_package.rb
263
264
  - lib/hammer_cli_katello/host_collection_package_group.rb
264
265
  - lib/hammer_cli_katello/host_content_source_options.rb
266
+ - lib/hammer_cli_katello/host_deb.rb
265
267
  - lib/hammer_cli_katello/host_errata.rb
266
268
  - lib/hammer_cli_katello/host_extensions.rb
267
269
  - lib/hammer_cli_katello/host_kickstart_repository_options.rb
268
270
  - lib/hammer_cli_katello/host_package.rb
269
271
  - lib/hammer_cli_katello/host_package_group.rb
270
272
  - lib/hammer_cli_katello/host_subscription.rb
273
+ - lib/hammer_cli_katello/host_traces.rb
271
274
  - lib/hammer_cli_katello/hostgroup.rb
272
275
  - lib/hammer_cli_katello/hostgroup_extensions.rb
273
276
  - lib/hammer_cli_katello/i18n.rb
@@ -324,6 +327,8 @@ files:
324
327
  - test/data/3.13/foreman_api.json
325
328
  - test/data/3.14/foreman_api.json
326
329
  - test/data/3.15/foreman_api.json
330
+ - test/data/3.16/foreman_api.json
331
+ - test/data/3.17/foreman_api.json
327
332
  - test/data/3.2/foreman_api.json
328
333
  - test/data/3.4/foreman_api.json
329
334
  - test/data/3.5/foreman_api.json
@@ -420,6 +425,7 @@ files:
420
425
  - test/functional/host/subscription/register_test.rb
421
426
  - test/functional/host/subscription/remove_test.rb
422
427
  - test/functional/host/subscription/unregister_test.rb
428
+ - test/functional/host/traces/list_test.rb
423
429
  - test/functional/host_collection/add_host_test.rb
424
430
  - test/functional/host_collection/content_api_expectations.rb
425
431
  - test/functional/host_collection/content_install_test.rb
@@ -512,8 +518,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
512
518
  - !ruby/object:Gem::Version
513
519
  version: '0'
514
520
  requirements: []
515
- rubyforge_project:
516
- rubygems_version: 2.7.6.2
521
+ rubygems_version: 3.1.2
517
522
  signing_key:
518
523
  specification_version: 4
519
524
  summary: Katello commands for Hammer
@@ -526,6 +531,8 @@ test_files:
526
531
  - test/data/3.13/foreman_api.json
527
532
  - test/data/3.14/foreman_api.json
528
533
  - test/data/3.15/foreman_api.json
534
+ - test/data/3.16/foreman_api.json
535
+ - test/data/3.17/foreman_api.json
529
536
  - test/data/3.2/foreman_api.json
530
537
  - test/data/3.4/foreman_api.json
531
538
  - test/data/3.5/foreman_api.json
@@ -622,6 +629,7 @@ test_files:
622
629
  - test/functional/host/subscription/register_test.rb
623
630
  - test/functional/host/subscription/remove_test.rb
624
631
  - test/functional/host/subscription/unregister_test.rb
632
+ - test/functional/host/traces/list_test.rb
625
633
  - test/functional/host_collection/add_host_test.rb
626
634
  - test/functional/host_collection/content_api_expectations.rb
627
635
  - test/functional/host_collection/content_install_test.rb