hammer_cli_katello 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,37 @@
1
+ require_relative '../test_helper'
2
+ require 'hammer_cli_katello/host_collection'
3
+
4
+ module HammerCLIKatello
5
+ describe HostCollection::InstallContentBaseCommand do
6
+ it 'installs packages to hosts in a host collection' do
7
+ api_expects(:hosts_bulk_actions, :install_content) do |p|
8
+ p['organization_id'] == 1 &&
9
+ p['included'] == { search: "host_collection_id=\"3\"" } &&
10
+ p['content'] == ['wget']
11
+ end
12
+
13
+ run_cmd(%w(host-collection package install --id 3 --packages wget --organization-id 1))
14
+ end
15
+
16
+ it 'installs package groups to hosts in a host collection' do
17
+ api_expects(:hosts_bulk_actions, :install_content) do |p|
18
+ p['organization_id'] == 1 &&
19
+ p['included'] == { search: "host_collection_id=\"3\"" } &&
20
+ p['content'] == ['birds']
21
+ end
22
+
23
+ run_cmd(%w(host-collection package-group install --id 3
24
+ --package-groups birds --organization-id 1))
25
+ end
26
+
27
+ it 'installs erratum to hosts in a host collection' do
28
+ api_expects(:hosts_bulk_actions, :install_content) do |p|
29
+ p['organization_id'] == 1 &&
30
+ p['included'] == { search: "host_collection_id=\"3\"" } &&
31
+ p['content'] == ['Bird_Erratum']
32
+ end
33
+
34
+ run_cmd(%w(host-collection erratum install --id 3 --errata Bird_Erratum --organization-id 1))
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,27 @@
1
+ require_relative '../test_helper'
2
+ require 'hammer_cli_katello/host_collection'
3
+
4
+ module HammerCLIKatello
5
+ describe HostCollection::RemoveContentBaseCommand do
6
+ it 'removes packages from hosts in a host collection' do
7
+ api_expects(:hosts_bulk_actions, :remove_content) do |p|
8
+ p['organization_id'] == 1 &&
9
+ p['included'] == { search: "host_collection_id=\"3\"" } &&
10
+ p['content'] == ['wget']
11
+ end
12
+
13
+ run_cmd(%w(host-collection package remove --id 3 --packages wget --organization-id 1))
14
+ end
15
+
16
+ it 'removes package groups from hosts in a host collection' do
17
+ api_expects(:hosts_bulk_actions, :remove_content) do |p|
18
+ p['organization_id'] == 1 &&
19
+ p['included'] == { search: "host_collection_id=\"3\"" } &&
20
+ p['content'] == ['birds']
21
+ end
22
+
23
+ run_cmd(%w(host-collection package-group remove --id 3
24
+ --package-groups birds --organization-id 1))
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ require_relative '../test_helper'
2
+ require 'hammer_cli_katello/host_collection'
3
+
4
+ module HammerCLIKatello
5
+ describe HostCollection::UpdateContentBaseCommand do
6
+ it 'updates packages on hosts in a host collection' do
7
+ api_expects(:hosts_bulk_actions, :update_content) do |p|
8
+ p['organization_id'] == 1 &&
9
+ p['included'] == { search: "host_collection_id=\"3\"" } &&
10
+ p['content'] == ['wget']
11
+ end
12
+
13
+ run_cmd(%w(host-collection package update --id 3 --packages wget --organization-id 1))
14
+ end
15
+
16
+ it 'updates package groups on hosts in a host collection' do
17
+ api_expects(:hosts_bulk_actions, :update_content) do |p|
18
+ p['organization_id'] == 1 &&
19
+ p['included'] == { search: "host_collection_id=\"3\"" } &&
20
+ p['content'] == ['birds']
21
+ end
22
+
23
+ run_cmd(%w(host-collection package-group update --id 3
24
+ --package-groups birds --organization-id 1))
25
+ end
26
+ end
27
+ end
@@ -38,5 +38,26 @@ module HammerCLIKatello
38
38
 
39
39
  run_cmd(%w(host-collection list --organization-label org1))
40
40
  end
41
+
42
+ it 'allows host id' do
43
+ api_expects(:host_collections, :index) do |par|
44
+ par['host_id'] == 1
45
+ end
46
+
47
+ run_cmd(%w(host-collection list --host-id 1))
48
+ end
49
+
50
+ it 'allows host name' do
51
+ ex = api_expects(:hosts, :index) do |par|
52
+ par[:search] == "name = \"host1\""
53
+ end
54
+ ex.returns(index_response([{'id' => 1}]))
55
+
56
+ api_expects(:host_collections, :index) do |par|
57
+ par['host_id'] == 1
58
+ end
59
+
60
+ run_cmd(%w(host-collection list --host host1))
61
+ end
41
62
  end
42
63
  end
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Price
@@ -34,7 +34,7 @@ authors:
34
34
  autorequire:
35
35
  bindir: bin
36
36
  cert_chain: []
37
- date: 2016-09-09 00:00:00.000000000 Z
37
+ date: 2016-10-21 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: hammer_cli_foreman
@@ -335,6 +335,9 @@ files:
335
335
  - test/functional/host/subscription/remove_test.rb
336
336
  - test/functional/host/subscription/unregister_test.rb
337
337
  - test/functional/host_collection/add_host_test.rb
338
+ - test/functional/host_collection/content_install_test.rb
339
+ - test/functional/host_collection/content_remove_test.rb
340
+ - test/functional/host_collection/content_update_test.rb
338
341
  - test/functional/host_collection/copy_test.rb
339
342
  - test/functional/host_collection/create_test.rb
340
343
  - test/functional/host_collection/delete_test.rb
@@ -391,7 +394,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
391
394
  version: '0'
392
395
  requirements: []
393
396
  rubyforge_project:
394
- rubygems_version: 2.4.6
397
+ rubygems_version: 2.4.8
395
398
  signing_key:
396
399
  specification_version: 4
397
400
  summary: Katello commands for Hammer
@@ -439,6 +442,9 @@ test_files:
439
442
  - test/functional/host/subscription/remove_test.rb
440
443
  - test/functional/host/subscription/unregister_test.rb
441
444
  - test/functional/host_collection/add_host_test.rb
445
+ - test/functional/host_collection/content_install_test.rb
446
+ - test/functional/host_collection/content_remove_test.rb
447
+ - test/functional/host_collection/content_update_test.rb
442
448
  - test/functional/host_collection/copy_test.rb
443
449
  - test/functional/host_collection/create_test.rb
444
450
  - test/functional/host_collection/delete_test.rb