hammer_cli_foreman 0.0.10 → 0.0.11

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.

Potentially problematic release.


This version of hammer_cli_foreman might be problematic. Click here for more details.

Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -0
  3. data/doc/host_create.md +190 -0
  4. data/lib/hammer_cli_foreman.rb +1 -0
  5. data/lib/hammer_cli_foreman/commands.rb +21 -7
  6. data/lib/hammer_cli_foreman/common_parameter.rb +12 -18
  7. data/lib/hammer_cli_foreman/domain.rb +8 -6
  8. data/lib/hammer_cli_foreman/environment.rb +10 -0
  9. data/lib/hammer_cli_foreman/exception_handler.rb +11 -1
  10. data/lib/hammer_cli_foreman/exceptions.rb +9 -0
  11. data/lib/hammer_cli_foreman/host.rb +107 -16
  12. data/lib/hammer_cli_foreman/hostgroup.rb +10 -0
  13. data/lib/hammer_cli_foreman/puppet_class.rb +10 -1
  14. data/lib/hammer_cli_foreman/resource_supported_test.rb +3 -3
  15. data/lib/hammer_cli_foreman/smart_class_parameter.rb +110 -0
  16. data/lib/hammer_cli_foreman/version.rb +1 -1
  17. data/test/unit/apipie_resource_mock.rb +88 -0
  18. data/test/unit/architecture_test.rb +91 -0
  19. data/test/unit/common_parameter_test.rb +77 -0
  20. data/test/unit/compute_resource_test.rb +94 -0
  21. data/test/unit/domain_test.rb +130 -0
  22. data/test/unit/environment_test.rb +110 -0
  23. data/test/unit/exception_handler_test.rb +48 -0
  24. data/test/unit/fact_test.rb +31 -0
  25. data/test/unit/helpers/command.rb +69 -0
  26. data/test/unit/helpers/resource_disabled.rb +24 -0
  27. data/test/unit/host_test.rb +315 -0
  28. data/test/unit/hostgroup_test.rb +145 -0
  29. data/test/unit/image_test.rb +136 -0
  30. data/test/unit/location_test.rb +109 -0
  31. data/test/unit/media_test.rb +106 -0
  32. data/test/unit/model_test.rb +98 -0
  33. data/test/unit/operating_system_test.rb +151 -0
  34. data/test/unit/organization_test.rb +109 -0
  35. data/test/unit/output/formatters_test.rb +19 -0
  36. data/test/unit/partition_table_test.rb +143 -0
  37. data/test/unit/puppet_class_test.rb +71 -0
  38. data/test/unit/report_test.rb +64 -0
  39. data/test/unit/smart_class_parameter_test.rb +77 -0
  40. data/test/unit/smart_proxy_test.rb +102 -0
  41. data/test/unit/subnet_test.rb +95 -0
  42. data/test/unit/template_test.rb +141 -0
  43. data/test/unit/test_helper.rb +27 -0
  44. data/test/unit/test_output_adapter.rb +19 -0
  45. data/test/unit/user_test.rb +92 -0
  46. metadata +107 -29
@@ -0,0 +1,27 @@
1
+ require 'simplecov'
2
+ require 'pathname'
3
+
4
+ SimpleCov.use_merging true
5
+ SimpleCov.start do
6
+ command_name 'MiniTest'
7
+ add_filter 'test'
8
+ end
9
+ SimpleCov.root Pathname.new(File.dirname(__FILE__) + "../../../")
10
+
11
+
12
+ require 'minitest/autorun'
13
+ require 'minitest/spec'
14
+ require "minitest-spec-context"
15
+ require "mocha/setup"
16
+
17
+ require 'hammer_cli_foreman'
18
+
19
+ def ctx
20
+ { :adapter => :silent }
21
+ end
22
+
23
+
24
+ require File.join(File.dirname(__FILE__), 'test_output_adapter')
25
+ require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
26
+ require File.join(File.dirname(__FILE__), 'helpers/command')
27
+ require File.join(File.dirname(__FILE__), 'helpers/resource_disabled')
@@ -0,0 +1,19 @@
1
+ require 'hammer_cli/output/adapter/abstract'
2
+
3
+
4
+ class TestAdapter < HammerCLI::Output::Adapter::Abstract
5
+
6
+ def print_records(fields, data)
7
+ @separator = '#'
8
+ puts @separator+fields.collect{|f| f.label.to_s}.join(@separator)+@separator
9
+
10
+ data.collect do |d|
11
+ puts @separator+fields.collect{ |f| f.get_value(d).to_s }.join(@separator)+@separator
12
+ end
13
+ end
14
+
15
+ end
16
+
17
+ HammerCLI::Output::Output.register_adapter(:test, TestAdapter)
18
+
19
+
@@ -0,0 +1,92 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
3
+
4
+
5
+ describe HammerCLIForeman::User do
6
+
7
+ extend CommandTestHelper
8
+
9
+ before :each do
10
+ cmd.class.resource ApipieResourceMock.new(cmd.class.resource.resource_class)
11
+ end
12
+
13
+ let(:cmd_module) { HammerCLIForeman::User }
14
+
15
+ context "ListCommand" do
16
+
17
+ let(:cmd) { cmd_module::ListCommand.new("", ctx ) }
18
+
19
+ context "parameters" do
20
+ it_should_accept "no arguments"
21
+ it_should_accept_search_params
22
+ end
23
+
24
+ context "output" do
25
+ let(:expected_record_count) { cmd.resource.call(:index)[0].length }
26
+
27
+ it_should_print_n_records
28
+ it_should_print_columns ["Id", "Login", "Name", "Email"]
29
+ end
30
+
31
+ end
32
+
33
+
34
+ context "InfoCommand" do
35
+
36
+ let(:cmd) { cmd_module::InfoCommand.new("", ctx) }
37
+
38
+ context "parameters" do
39
+ it_should_accept "id", ["--id=1"]
40
+ it_should_fail_with "no arguments"
41
+ end
42
+
43
+ context "output" do
44
+ with_params ["--id=1"] do
45
+ it_should_print_n_records 1
46
+ it_should_print_columns ["Id", "Login", "Name", "Email"]
47
+ it_should_print_columns ["Last login", "Created at", "Updated at"]
48
+ end
49
+ end
50
+
51
+ end
52
+
53
+
54
+ context "CreateCommand" do
55
+
56
+ let(:cmd) { cmd_module::CreateCommand.new("", ctx) }
57
+
58
+ context "parameters" do
59
+ it_should_accept "all required", ["--login=login", "--mail=mail", "--password=paswd", "--auth-source-id=1"]
60
+ it_should_accept "all required plus names", ["--login=login", "--firstname=fname", "--lastname=lname", "--mail=mail", "--password=paswd", "--auth-source-id=1"]
61
+ it_should_fail_with "login missing", ["--firstname=fname", "--lastname=lname", "--mail=mail", "--password=paswd", "--auth-source-id=1"]
62
+ it_should_fail_with "mail missing", ["--login=login", "--firstname=fname", "--lastname=lname", "--password=paswd", "--auth-source-id=1"]
63
+ it_should_fail_with "password missing", ["--login=login", "--firstname=fname", "--lastname=lname", "--mail=mail", "--auth-source-id=1"]
64
+ it_should_fail_with "auth source missing", ["--login=login", "--firstname=fname", "--lastname=lname", "--mail=mail", "--password=paswd"]
65
+ end
66
+
67
+ end
68
+
69
+
70
+ context "DeleteCommand" do
71
+
72
+ let(:cmd) { cmd_module::DeleteCommand.new("", ctx) }
73
+
74
+ context "parameters" do
75
+ it_should_accept "id", ["--id=1"]
76
+ it_should_fail_with "id missing", []
77
+ end
78
+
79
+ end
80
+
81
+
82
+ context "UpdateCommand" do
83
+
84
+ let(:cmd) { cmd_module::UpdateCommand.new("", ctx) }
85
+
86
+ context "parameters" do
87
+ it_should_accept "id", ["--id=1"]
88
+ it_should_fail_with "no params", []
89
+ end
90
+
91
+ end
92
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomáš Strachota
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-08 00:00:00.000000000 Z
12
+ date: 2013-11-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hammer_cli
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '>='
19
19
  - !ruby/object:Gem::Version
20
- version: 0.0.9
20
+ version: 0.0.10
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '>='
26
26
  - !ruby/object:Gem::Version
27
- version: 0.0.9
27
+ version: 0.0.10
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: foreman_api
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -39,44 +39,93 @@ dependencies:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
41
  version: 0.1.8
42
+ - !ruby/object:Gem::Dependency
43
+ name: mime-types
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - <
47
+ - !ruby/object:Gem::Version
48
+ version: 2.0.0
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - <
54
+ - !ruby/object:Gem::Version
55
+ version: 2.0.0
42
56
  description: |
43
57
  Foreman commands for Hammer CLI
44
58
  email: tstracho@redhat.com
45
59
  executables: []
46
60
  extensions: []
47
- extra_rdoc_files: []
61
+ extra_rdoc_files:
62
+ - README.md
63
+ - doc/host_create.md
48
64
  files:
49
- - lib/hammer_cli_foreman/report.rb
50
- - lib/hammer_cli_foreman/media.rb
65
+ - README.md
66
+ - doc/host_create.md
67
+ - lib/hammer_cli_foreman.rb
68
+ - lib/hammer_cli_foreman/architecture.rb
69
+ - lib/hammer_cli_foreman/associating_commands.rb
70
+ - lib/hammer_cli_foreman/commands.rb
71
+ - lib/hammer_cli_foreman/common_parameter.rb
72
+ - lib/hammer_cli_foreman/compute_resource.rb
51
73
  - lib/hammer_cli_foreman/domain.rb
52
- - lib/hammer_cli_foreman/partition_table.rb
53
- - lib/hammer_cli_foreman/resource_supported_test.rb
74
+ - lib/hammer_cli_foreman/environment.rb
75
+ - lib/hammer_cli_foreman/exception_handler.rb
76
+ - lib/hammer_cli_foreman/exceptions.rb
77
+ - lib/hammer_cli_foreman/fact.rb
54
78
  - lib/hammer_cli_foreman/host.rb
55
79
  - lib/hammer_cli_foreman/hostgroup.rb
80
+ - lib/hammer_cli_foreman/image.rb
81
+ - lib/hammer_cli_foreman/location.rb
82
+ - lib/hammer_cli_foreman/media.rb
83
+ - lib/hammer_cli_foreman/model.rb
84
+ - lib/hammer_cli_foreman/operating_system.rb
56
85
  - lib/hammer_cli_foreman/organization.rb
86
+ - lib/hammer_cli_foreman/output.rb
87
+ - lib/hammer_cli_foreman/output/fields.rb
88
+ - lib/hammer_cli_foreman/output/formatters.rb
57
89
  - lib/hammer_cli_foreman/parameter.rb
58
- - lib/hammer_cli_foreman/environment.rb
90
+ - lib/hammer_cli_foreman/partition_table.rb
59
91
  - lib/hammer_cli_foreman/puppet_class.rb
60
- - lib/hammer_cli_foreman/user.rb
61
- - lib/hammer_cli_foreman/version.rb
62
- - lib/hammer_cli_foreman/associating_commands.rb
63
- - lib/hammer_cli_foreman/fact.rb
92
+ - lib/hammer_cli_foreman/report.rb
93
+ - lib/hammer_cli_foreman/resource_supported_test.rb
94
+ - lib/hammer_cli_foreman/smart_class_parameter.rb
95
+ - lib/hammer_cli_foreman/smart_proxy.rb
64
96
  - lib/hammer_cli_foreman/subnet.rb
65
- - lib/hammer_cli_foreman/exception_handler.rb
66
- - lib/hammer_cli_foreman/output.rb
67
- - lib/hammer_cli_foreman/compute_resource.rb
68
- - lib/hammer_cli_foreman/common_parameter.rb
69
- - lib/hammer_cli_foreman/commands.rb
70
- - lib/hammer_cli_foreman/architecture.rb
71
- - lib/hammer_cli_foreman/location.rb
72
- - lib/hammer_cli_foreman/output/formatters.rb
73
- - lib/hammer_cli_foreman/output/fields.rb
74
- - lib/hammer_cli_foreman/operating_system.rb
75
- - lib/hammer_cli_foreman/image.rb
76
- - lib/hammer_cli_foreman/model.rb
77
97
  - lib/hammer_cli_foreman/template.rb
78
- - lib/hammer_cli_foreman/smart_proxy.rb
79
- - lib/hammer_cli_foreman.rb
98
+ - lib/hammer_cli_foreman/user.rb
99
+ - lib/hammer_cli_foreman/version.rb
100
+ - test/unit/apipie_resource_mock.rb
101
+ - test/unit/architecture_test.rb
102
+ - test/unit/common_parameter_test.rb
103
+ - test/unit/compute_resource_test.rb
104
+ - test/unit/domain_test.rb
105
+ - test/unit/environment_test.rb
106
+ - test/unit/exception_handler_test.rb
107
+ - test/unit/fact_test.rb
108
+ - test/unit/helpers/command.rb
109
+ - test/unit/helpers/resource_disabled.rb
110
+ - test/unit/host_test.rb
111
+ - test/unit/hostgroup_test.rb
112
+ - test/unit/image_test.rb
113
+ - test/unit/location_test.rb
114
+ - test/unit/media_test.rb
115
+ - test/unit/model_test.rb
116
+ - test/unit/operating_system_test.rb
117
+ - test/unit/organization_test.rb
118
+ - test/unit/output/formatters_test.rb
119
+ - test/unit/partition_table_test.rb
120
+ - test/unit/puppet_class_test.rb
121
+ - test/unit/report_test.rb
122
+ - test/unit/smart_class_parameter_test.rb
123
+ - test/unit/smart_proxy_test.rb
124
+ - test/unit/subnet_test.rb
125
+ - test/unit/template_test.rb
126
+ - test/unit/test_helper.rb
127
+ - test/unit/test_output_adapter.rb
128
+ - test/unit/user_test.rb
80
129
  homepage: http://github.com/theforeman/hammer-cli-foreman
81
130
  licenses: []
82
131
  metadata: {}
@@ -100,5 +149,34 @@ rubygems_version: 2.0.8
100
149
  signing_key:
101
150
  specification_version: 4
102
151
  summary: Foreman commands for Hammer
103
- test_files: []
152
+ test_files:
153
+ - test/unit/apipie_resource_mock.rb
154
+ - test/unit/architecture_test.rb
155
+ - test/unit/common_parameter_test.rb
156
+ - test/unit/compute_resource_test.rb
157
+ - test/unit/domain_test.rb
158
+ - test/unit/environment_test.rb
159
+ - test/unit/exception_handler_test.rb
160
+ - test/unit/fact_test.rb
161
+ - test/unit/helpers/command.rb
162
+ - test/unit/helpers/resource_disabled.rb
163
+ - test/unit/host_test.rb
164
+ - test/unit/hostgroup_test.rb
165
+ - test/unit/image_test.rb
166
+ - test/unit/location_test.rb
167
+ - test/unit/media_test.rb
168
+ - test/unit/model_test.rb
169
+ - test/unit/operating_system_test.rb
170
+ - test/unit/organization_test.rb
171
+ - test/unit/output/formatters_test.rb
172
+ - test/unit/partition_table_test.rb
173
+ - test/unit/puppet_class_test.rb
174
+ - test/unit/report_test.rb
175
+ - test/unit/smart_class_parameter_test.rb
176
+ - test/unit/smart_proxy_test.rb
177
+ - test/unit/subnet_test.rb
178
+ - test/unit/template_test.rb
179
+ - test/unit/test_helper.rb
180
+ - test/unit/test_output_adapter.rb
181
+ - test/unit/user_test.rb
104
182
  has_rdoc: