hammer_cli_katello 1.5.3 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), '../test_helper')
2
2
 
3
3
  describe 'create content-credentials' do
4
4
  before do
5
- @cmd = %w(alternate-content-sources create)
5
+ @cmd = %w(alternate-content-source create)
6
6
  end
7
7
 
8
8
  let(:name) { 'pizza' }
@@ -7,7 +7,7 @@ describe 'delete an acs' do
7
7
  api_expects(:alternate_content_sources, :destroy, 'delete acs').
8
8
  with_params('id' => id)
9
9
 
10
- command = %W(alternate-content-sources delete --id #{id})
10
+ command = %W(alternate-content-source delete --id #{id})
11
11
  assert_equal(0, run_cmd(command).exit_code)
12
12
  end
13
13
  end
@@ -3,7 +3,7 @@ require 'hammer_cli_katello/associating_commands'
3
3
 
4
4
  describe 'get acs info' do
5
5
  before do
6
- @cmd = %w(alternate-content-sources info)
6
+ @cmd = %w(alternate-content-source info)
7
7
  end
8
8
 
9
9
  it 'shows acs info by id' do
@@ -14,20 +14,17 @@ describe 'get acs info' do
14
14
  'name' => 'Pizza ACS',
15
15
  'label' => 'Pizza ACS',
16
16
  'base_url' => 'https://proxy.example.com',
17
- 'alternate_content_source_type' => 'custom',
18
17
  'content_type' => 'yum',
18
+ 'alternate_content_source_type' => 'custom',
19
+ 'subpaths' => [
20
+ 'test/repo1'
21
+ ],
19
22
  'smart_proxies' => {
20
23
  'id' => 1,
21
24
  'name' => 'centos7.example.com',
22
25
  'url' => 'https://centos7.example.com:9090',
23
- 'created_at' => '2022-05-09T17:40:21.007Z',
24
- 'updated_at' => '2022-05-09T17:40:21.007Z',
25
- 'expired_logs' => 0,
26
26
  'download_policy' => 'on_demand'
27
- },
28
- 'subpaths' => [
29
- 'test/repo1'
30
- ]
27
+ }
31
28
  )
32
29
  result = run_cmd(@cmd + params)
33
30
  # rubocop:disable Style/WordArray
@@ -35,18 +32,60 @@ describe 'get acs info' do
35
32
  ['Name', 'Pizza ACS'],
36
33
  ['Label', 'Pizza ACS'],
37
34
  ['Base URL', 'https://proxy.example.com'],
35
+ ['Content type', 'yum'],
38
36
  ['Alternate content source type', 'custom'],
37
+ ['Subpaths', ''],
38
+ ['', 'test/repo1'],
39
+ ['Smart proxies', ''],
40
+ ['Id', '1'],
41
+ ['Name', 'centos7.example.com'],
42
+ ['URL', 'https://centos7.example.com:9090'],
43
+ ['Download policy', 'on_demand']]
44
+
45
+ # rubocop:enable Style/WordArray
46
+ expected_results = expected_fields.map { |field| success_result(FieldMatcher.new(*field)) }
47
+ expected_results.each { |expected| assert_cmd(expected, result) }
48
+ end
49
+
50
+ it 'shows simplified acs info by id' do
51
+ params = ['--id=2']
52
+ ex = api_expects(:alternate_content_sources, :show, 'Get info')
53
+ ex.returns(
54
+ 'id' => 2,
55
+ 'name' => 'Pizza ACS',
56
+ 'label' => 'Pizza ACS',
57
+ 'content_type' => 'yum',
58
+ 'alternate_content_source_type' => 'simplified',
59
+ 'products' => {
60
+ 'id' => 999,
61
+ 'organization_id' => 9,
62
+ 'name' => 'Buttermilk Biscuits',
63
+ 'label' => 'Buttermilk_Biscuits'
64
+ },
65
+ 'smart_proxies' => {
66
+ 'id' => 1,
67
+ 'name' => 'centos7.example.com',
68
+ 'url' => 'https://centos7.example.com:9090',
69
+ 'download_policy' => 'on_demand'
70
+ }
71
+ )
72
+ result = run_cmd(@cmd + params)
73
+ # rubocop:disable Style/WordArray
74
+ expected_fields = [['ID', '2'],
75
+ ['Name', 'Pizza ACS'],
76
+ ['Label', 'Pizza ACS'],
39
77
  ['Content type', 'yum'],
78
+ ['Alternate content source type', 'simplified'],
79
+ ['Products', ''],
80
+ ['Id', '999'],
81
+ ['Organization ID', '9'],
82
+ ['Name', 'Buttermilk Biscuits'],
83
+ ['Label', 'Buttermilk_Biscuits'],
40
84
  ['Smart proxies', ''],
41
85
  ['Id', '1'],
42
86
  ['Name', 'centos7.example.com'],
43
87
  ['URL', 'https://centos7.example.com:9090'],
44
- ['Created at', '2022-05-09T17:40:21.007Z'],
45
- ['Updated at', '2022-05-09T17:40:21.007Z'],
46
- ['Expired logs', '0'],
47
- ['Download policy', 'on_demand'],
48
- ['Subpaths', ''],
49
- ['', 'test/repo1']]
88
+ ['Download policy', 'on_demand']]
50
89
 
51
90
  # rubocop:enable Style/WordArray
52
91
  expected_results = expected_fields.map { |field| success_result(FieldMatcher.new(*field)) }
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), '../test_helper')
2
2
 
3
3
  describe 'listing acs' do
4
4
  before do
5
- @cmd = %w(alternate-content-sources list)
5
+ @cmd = %w(alternate-content-source list)
6
6
  end
7
7
 
8
8
  let(:empty_response) do
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), '../test_helper')
2
2
 
3
3
  describe 'listing acs' do
4
4
  before do
5
- @cmd = %w(alternate-content-sources update)
5
+ @cmd = %w(alternate-content-source update)
6
6
  end
7
7
 
8
8
  let(:id) { 1 }
@@ -0,0 +1,39 @@
1
+ require File.join(File.dirname(__FILE__), '../../test_helper')
2
+
3
+ describe 'host enabled-repositories listing' do
4
+ before do
5
+ @cmd = %w(host subscription enabled-repositories)
6
+ end
7
+
8
+ let(:host_id) { 1 }
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
+ it 'allows listing by host' do
26
+ params = ["--host-id=#{host_id}"]
27
+ ex = api_expects(:host_subscriptions,
28
+ :enabled_repositories, 'host subscription enabled-repositories')
29
+ ex.returns(empty_response)
30
+ # rubocop:disable Layout/LineLength
31
+ expected_result = success_result("---|------|-------|--------------|----------|-----------------|-------------------|----------------------|------------------|-------------
32
+ ID | NAME | LABEL | CONTENT TYPE | CHECKSUM | CONTENT VIEW ID | CONTENT VIEW NAME | CONTENT VIEW VERSION | ENVIRONMENT NAME | PRODUCT NAME
33
+ ---|------|-------|--------------|----------|-----------------|-------------------|----------------------|------------------|-------------
34
+ ")
35
+ # rubocop:enable Layout/LineLength
36
+ result = run_cmd(@cmd + params)
37
+ assert_cmd(expected_result, result)
38
+ end
39
+ end
@@ -0,0 +1,29 @@
1
+ require File.join(File.dirname(__FILE__), '../../test_helper')
2
+
3
+ describe 'simple-content-access status' do
4
+ before do
5
+ @cmd = %w(simple-content-access status)
6
+ end
7
+
8
+ let(:organization_id) { 3 }
9
+
10
+ it 'list status with required options' do
11
+ params = ["--organization-id=#{organization_id}"]
12
+ api_expects(:simple_content_access, :status).
13
+ with_params('organization_id' => organization_id).
14
+ returns('simple_content_access' => true)
15
+
16
+ run_cmd(@cmd + params)
17
+ end
18
+
19
+ it 'fails on missing required params' do
20
+ params = []
21
+ result = run_cmd(@cmd + params)
22
+ # rubocop:disable Layout/LineLength
23
+ expected_error = 'Could not find organization, please set one of options --organization-id, --organization, --organization-title, --organization-label.'
24
+ # rubocop:enable Layout/LineLength
25
+
26
+ assert_equal(result.exit_code, HammerCLI::EX_SOFTWARE)
27
+ assert_equal(result.err[/#{expected_error}/], expected_error)
28
+ end
29
+ 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.5')
20
+ KATELLO_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '4.6')
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.5.3
4
+ version: 1.6.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-09-28 00:00:00.000000000 Z
38
+ date: 2022-08-01 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: hammer_cli_foreman
@@ -321,6 +321,7 @@ files:
321
321
  - test/data/4.3/foreman_api.json
322
322
  - test/data/4.4/foreman_api.json
323
323
  - test/data/4.5/foreman_api.json
324
+ - test/data/4.6/foreman_api.json
324
325
  - test/data/Readme.md
325
326
  - test/functional/acs/create_test.rb
326
327
  - test/functional/acs/delete_test.rb
@@ -423,6 +424,7 @@ files:
423
424
  - test/functional/host/subscription/attach_test.rb
424
425
  - test/functional/host/subscription/auto_attach_test.rb
425
426
  - test/functional/host/subscription/content_override_test.rb
427
+ - test/functional/host/subscription/enabled_repositories_test.rb
426
428
  - test/functional/host/subscription/product_content_test.rb
427
429
  - test/functional/host/subscription/register_test.rb
428
430
  - test/functional/host/subscription/remove_test.rb
@@ -489,6 +491,7 @@ files:
489
491
  - test/functional/search_helpers.rb
490
492
  - test/functional/simple_content_access/disable_test.rb
491
493
  - test/functional/simple_content_access/enable_test.rb
494
+ - test/functional/simple_content_access/status_test.rb
492
495
  - test/functional/srpm/list_test.rb
493
496
  - test/functional/subscription/list_test.rb
494
497
  - test/functional/sync_plan/create_test.rb
@@ -552,6 +555,7 @@ test_files:
552
555
  - test/data/4.3/foreman_api.json
553
556
  - test/data/4.4/foreman_api.json
554
557
  - test/data/4.5/foreman_api.json
558
+ - test/data/4.6/foreman_api.json
555
559
  - test/data/Readme.md
556
560
  - test/functional/acs/create_test.rb
557
561
  - test/functional/acs/delete_test.rb
@@ -654,6 +658,7 @@ test_files:
654
658
  - test/functional/host/subscription/attach_test.rb
655
659
  - test/functional/host/subscription/auto_attach_test.rb
656
660
  - test/functional/host/subscription/content_override_test.rb
661
+ - test/functional/host/subscription/enabled_repositories_test.rb
657
662
  - test/functional/host/subscription/product_content_test.rb
658
663
  - test/functional/host/subscription/register_test.rb
659
664
  - test/functional/host/subscription/remove_test.rb
@@ -720,6 +725,7 @@ test_files:
720
725
  - test/functional/search_helpers.rb
721
726
  - test/functional/simple_content_access/disable_test.rb
722
727
  - test/functional/simple_content_access/enable_test.rb
728
+ - test/functional/simple_content_access/status_test.rb
723
729
  - test/functional/srpm/list_test.rb
724
730
  - test/functional/subscription/list_test.rb
725
731
  - test/functional/sync_plan/create_test.rb