hammer_cli_foreman 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -1
  3. data/doc/configuration.md +13 -0
  4. data/lib/hammer_cli_foreman.rb +3 -0
  5. data/lib/hammer_cli_foreman/architecture.rb +9 -9
  6. data/lib/hammer_cli_foreman/associating_commands.rb +57 -34
  7. data/lib/hammer_cli_foreman/commands.rb +188 -101
  8. data/lib/hammer_cli_foreman/common_parameter.rb +7 -10
  9. data/lib/hammer_cli_foreman/compute_resource.rb +8 -11
  10. data/lib/hammer_cli_foreman/domain.rb +14 -40
  11. data/lib/hammer_cli_foreman/environment.rb +10 -15
  12. data/lib/hammer_cli_foreman/exceptions.rb +4 -0
  13. data/lib/hammer_cli_foreman/fact.rb +5 -5
  14. data/lib/hammer_cli_foreman/host.rb +76 -132
  15. data/lib/hammer_cli_foreman/hostgroup.rb +26 -61
  16. data/lib/hammer_cli_foreman/id_resolver.rb +163 -0
  17. data/lib/hammer_cli_foreman/image.rb +14 -50
  18. data/lib/hammer_cli_foreman/location.rb +35 -17
  19. data/lib/hammer_cli_foreman/media.rb +9 -16
  20. data/lib/hammer_cli_foreman/model.rb +6 -8
  21. data/lib/hammer_cli_foreman/operating_system.rb +129 -63
  22. data/lib/hammer_cli_foreman/organization.rb +36 -16
  23. data/lib/hammer_cli_foreman/output/fields.rb +10 -2
  24. data/lib/hammer_cli_foreman/output/formatters.rb +44 -18
  25. data/lib/hammer_cli_foreman/parameter.rb +45 -41
  26. data/lib/hammer_cli_foreman/partition_table.rb +9 -12
  27. data/lib/hammer_cli_foreman/puppet_class.rb +14 -14
  28. data/lib/hammer_cli_foreman/references.rb +122 -0
  29. data/lib/hammer_cli_foreman/report.rb +3 -6
  30. data/lib/hammer_cli_foreman/searchables_option_builder.rb +99 -0
  31. data/lib/hammer_cli_foreman/smart_class_parameter.rb +17 -13
  32. data/lib/hammer_cli_foreman/smart_proxy.rb +18 -28
  33. data/lib/hammer_cli_foreman/subnet.rb +12 -13
  34. data/lib/hammer_cli_foreman/template.rb +10 -19
  35. data/lib/hammer_cli_foreman/user.rb +9 -28
  36. data/lib/hammer_cli_foreman/version.rb +1 -1
  37. data/locale/hammer-cli-foreman.pot +828 -817
  38. data/test/unit/apipie_resource_mock.rb +33 -11
  39. data/test/unit/architecture_test.rb +7 -10
  40. data/test/unit/commands_test.rb +8 -9
  41. data/test/unit/common_parameter_test.rb +6 -8
  42. data/test/unit/compute_resource_test.rb +9 -12
  43. data/test/unit/data/1.5/foreman_api.json +14130 -0
  44. data/test/unit/domain_test.rb +19 -22
  45. data/test/unit/environment_test.rb +9 -11
  46. data/test/unit/fact_test.rb +5 -6
  47. data/test/unit/helpers/command.rb +115 -59
  48. data/test/unit/helpers/fake_searchables.rb +19 -0
  49. data/test/unit/host_test.rb +44 -33
  50. data/test/unit/hostgroup_test.rb +19 -26
  51. data/test/unit/id_resolver_test.rb +225 -0
  52. data/test/unit/image_test.rb +16 -18
  53. data/test/unit/location_test.rb +8 -10
  54. data/test/unit/media_test.rb +11 -13
  55. data/test/unit/model_test.rb +8 -10
  56. data/test/unit/operating_system_test.rb +23 -23
  57. data/test/unit/organization_test.rb +9 -10
  58. data/test/unit/output/formatters_test.rb +133 -20
  59. data/test/unit/partition_table_test.rb +12 -9
  60. data/test/unit/puppet_class_test.rb +3 -7
  61. data/test/unit/report_test.rb +3 -7
  62. data/test/unit/searchables_option_builder_test.rb +172 -0
  63. data/test/unit/smart_class_parameter_test.rb +5 -7
  64. data/test/unit/smart_proxy_test.rb +11 -12
  65. data/test/unit/subnet_test.rb +15 -16
  66. data/test/unit/template_test.rb +15 -12
  67. data/test/unit/test_helper.rb +1 -1
  68. data/test/unit/user_test.rb +9 -12
  69. metadata +536 -509
@@ -4,11 +4,7 @@ require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
4
4
 
5
5
  describe HammerCLIForeman::Hostgroup do
6
6
 
7
- extend CommandTestHelper
8
-
9
- before :each do
10
- cmd.stubs(:name_to_id).returns(1)
11
- end
7
+ include CommandTestHelper
12
8
 
13
9
  context "ListCommand" do
14
10
 
@@ -23,10 +19,8 @@ describe HammerCLIForeman::Hostgroup do
23
19
  let(:expected_record_count) { cmd.resource.call(:index).length }
24
20
 
25
21
  it_should_print_n_records
26
- it_should_print_columns ["Id", "Name", "Label", "Operating System Id", "Subnet Id"]
27
- it_should_print_columns ["Domain Id", "Environment Id", "Puppetclass Ids", "Ancestry"]
28
- it_should_print_columns ["Architecture Id", "Partition Table Id", "Medium Id"]
29
- it_should_print_columns ["Puppet CA Proxy Id", "Puppet Master Proxy Id"]
22
+ it_should_print_columns ["Id", "Name", "Label", "Operating System"]
23
+ it_should_print_columns ["Environment", "Model"]
30
24
  end
31
25
 
32
26
  end
@@ -35,20 +29,16 @@ describe HammerCLIForeman::Hostgroup do
35
29
 
36
30
  let(:cmd) { HammerCLIForeman::Hostgroup::InfoCommand.new("", ctx) }
37
31
 
38
- before :each do
39
- HammerCLIForeman::Parameter.stubs(:get_parameters).returns([])
40
- end
41
-
42
32
  context "parameters" do
43
33
  it_should_accept "id", ["--id=1"]
44
- it_should_fail_with "no arguments"
34
+ # it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
45
35
  end
46
36
 
47
37
  context "output" do
48
38
  with_params ["--id=1"] do
49
39
  it_should_print_n_records 1
50
- it_should_print_columns ["Id", "Name", "Label", "Operating System Id", "Subnet Id"]
51
- it_should_print_columns ["Domain Id", "Environment Id", "Puppetclass Ids", "Ancestry"]
40
+ it_should_print_columns ["Id", "Name", "Label", "Operating System", "Subnet"]
41
+ it_should_print_columns ["Domain", "Environment", "Puppetclasses", "Ancestry"]
52
42
  it_should_print_columns ["Parameters"]
53
43
  end
54
44
  end
@@ -61,7 +51,7 @@ describe HammerCLIForeman::Hostgroup do
61
51
 
62
52
  context "parameters" do
63
53
  it_should_accept "id", ["--id=1"]
64
- it_should_fail_with "id missing", []
54
+ # it_should_fail_with "no params", [] # TODO: temporarily disabled, parameters are checked in the id resolver
65
55
  end
66
56
 
67
57
  end
@@ -74,8 +64,9 @@ describe HammerCLIForeman::Hostgroup do
74
64
  it_should_accept "name, parent_id, environment_id, architecture_id, domain_id, puppet_proxy_id, operatingsystem_id and more",
75
65
  ["--name=hostgroup", "--parent-id=1", "--environment-id=1", "--architecture-id=1", "--domain-id=1", "--puppet-proxy-id=1",
76
66
  "--operatingsystem-id=1", "--medium-id=1", "--ptable-id=1", "--subnet-id=1", '--puppet-ca-proxy-id=1', '--puppetclass-ids=1,2']
77
- it_should_fail_with "name or id missing",
78
- ["--environment-id=1", "--architecture-id=1", "--domain-id=1", "--puppet-proxy-id=1", "--operatingsystem-id=1"]
67
+ # it_should_fail_with "name or id missing",
68
+ # ["--environment-id=1", "--architecture-id=1", "--domain-id=1", "--puppet-proxy-id=1", "--operatingsystem-id=1"]
69
+ # TODO: temporarily disabled, parameters are checked in the api
79
70
  end
80
71
  end
81
72
 
@@ -87,8 +78,9 @@ describe HammerCLIForeman::Hostgroup do
87
78
  it_should_accept "name, parent_id, environment_id, architecture_id, domain_id, puppet_proxy_id, operatingsystem_id and more",
88
79
  ["--id=1 --name=hostgroup2", "--parent-id=1", "--environment-id=1", "--architecture-id=1", "--domain-id=1", "--puppet-proxy-id=1",
89
80
  "--operatingsystem-id=1", "--medium-id=1", "--ptable-id=1", "--subnet-id=1", '--puppet-ca-proxy-id=1', '--puppetclass-ids=1,2']
90
- it_should_fail_with "no params", []
91
- it_should_fail_with "id missing", ["--name=host2"]
81
+ # it_should_fail_with "no params", []
82
+ # it_should_fail_with "id missing", ["--name=host2"]
83
+ # TODO: temporarily disabled, parameters are checked in the id resolver
92
84
  end
93
85
 
94
86
  end
@@ -106,7 +98,7 @@ describe HammerCLIForeman::Hostgroup do
106
98
  it_should_accept "name, value and hostgroup id", ["--name=name", "--value=val", "--hostgroup-id=id"]
107
99
  it_should_fail_with "name missing", ["--value=val", "--hostgroup-id=1"]
108
100
  it_should_fail_with "value missing", ["--name=name", "--hostgroup-id=1"]
109
- it_should_fail_with "hostgroup id missing", ["--name=name", "--value=val"]
101
+ # it_should_fail_with "hostgroup id missing", ["--name=name", "--value=val"] # TODO: temporarily disabled, parameters are checked in the id resolver
110
102
  end
111
103
 
112
104
  end
@@ -117,9 +109,10 @@ describe HammerCLIForeman::Hostgroup do
117
109
  let(:cmd) { HammerCLIForeman::Hostgroup::DeleteParameterCommand.new("", ctx) }
118
110
 
119
111
  context "parameters" do
120
- it_should_accept "name and hostgroup id", ["--name=name", "--hostgroup-id=id"]
121
- it_should_fail_with "name missing", ["--hostgroup-id=id"]
122
- it_should_fail_with "hostgroup id missing", ["--name=name"]
112
+ it_should_accept "name and hostgroup id", ["--name=param", "--hostgroup-id=id"]
113
+ # it_should_fail_with "name missing", ["--hostgroup-id=id"]
114
+ # it_should_fail_with "hostgroup id missing", ["--name=param"]
115
+ # TODO: temporarily disabled, parameters are checked in the id resolver
123
116
  end
124
117
 
125
118
  end
@@ -136,7 +129,7 @@ describe HammerCLIForeman::Hostgroup do
136
129
  context "parameters" do
137
130
  it_should_accept "name", ["--name=env"]
138
131
  it_should_accept "id", ["--id=1"]
139
- it_should_fail_with "name or id missing", []
132
+ # it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
140
133
  end
141
134
 
142
135
  end
@@ -0,0 +1,225 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
3
+ require File.join(File.dirname(__FILE__), 'helpers/fake_searchables')
4
+
5
+ describe HammerCLIForeman::IdResolver do
6
+
7
+ let(:api) { HammerCLIForeman.foreman_api_connection.api }
8
+ let(:searchables) { FakeSearchables.new(['name','label']) }
9
+ let(:resolver) { HammerCLIForeman::IdResolver.new(api, searchables) }
10
+
11
+ describe "scoped options" do
12
+ it "returns empty hash when there are no options" do
13
+ resolver.scoped_options("scope", {}).must_equal({})
14
+ end
15
+
16
+ it "unscopes options" do
17
+ scoped = {
18
+ "option_id" => 1,
19
+ "option_org_id" => 2,
20
+ "option_org_name" => "ACME",
21
+ "option_a" => :value
22
+ }
23
+ unscoped = {
24
+ "option_id" => 2,
25
+ "option_name" => "ACME",
26
+ "option_a" => :value
27
+ }
28
+ resolver.scoped_options("org", scoped).must_equal(unscoped)
29
+ end
30
+
31
+ it "does not change the original options" do
32
+ scoped = {
33
+ "option_id" => 1,
34
+ "option_org_id" => 2,
35
+ "option_org_name" => "ACME",
36
+ "option_a" => :value
37
+ }
38
+ scoped_original = scoped.dup
39
+ resolver.scoped_options("org", scoped)
40
+ scoped.must_equal(scoped_original)
41
+ end
42
+
43
+ end
44
+
45
+
46
+ describe "id params" do
47
+ let(:required_params) {[
48
+ stub(:name => "architecture_id", :required? => true),
49
+ stub(:name => "organization_id", :required? => true)
50
+ ]}
51
+ let(:id_params) {[
52
+ stub(:name => "domain_id", :required? => false)
53
+ ]}
54
+ let(:other_params) {[
55
+ stub(:name => "location", :required? => true),
56
+ stub(:name => "param", :required? => false)
57
+ ]}
58
+ let(:action) {
59
+ stub(:params => (required_params+id_params+other_params))
60
+ }
61
+
62
+ it "returns only required params ending with _id" do
63
+ resolver.id_params(action, :required => true).must_equal required_params
64
+ end
65
+
66
+ it "returns only ending with _id when :required is set to false" do
67
+ resolver.id_params(action, :required => false).must_equal (required_params+id_params)
68
+ end
69
+
70
+ it "returns required params by default" do
71
+ resolver.id_params(action).must_equal required_params
72
+ end
73
+ end
74
+
75
+ describe "param to resource" do
76
+
77
+ let(:expected_resource) { HammerCLIForeman.foreman_resource(:architectures) }
78
+
79
+ it "finds resource for params with _id" do
80
+ resolver.param_to_resource("architecture_id").name.must_equal expected_resource.name
81
+ end
82
+
83
+ it "finds resource for params without _id" do
84
+ resolver.param_to_resource("architecture").name.must_equal expected_resource.name
85
+ end
86
+
87
+ it "returns nil for unknown resource" do
88
+ resolver.param_to_resource("unknown").must_equal nil
89
+ end
90
+
91
+ end
92
+
93
+ describe "depedent resources" do
94
+
95
+ it "returns empty array for an independent resource" do
96
+ resource = HammerCLIForeman.foreman_resource(:architectures)
97
+ resolver.dependent_resources(resource).must_equal []
98
+ end
99
+
100
+ it "returns list of dependent resources" do
101
+ resource = HammerCLIForeman.foreman_resource(:images)
102
+ resolver.dependent_resources(resource).map(&:name).must_equal [:compute_resources]
103
+ end
104
+
105
+ end
106
+
107
+ describe "resolving ids" do
108
+
109
+ it "must define methods for all resources" do
110
+ expected_method_names = api.resources.map(&:singular_name).collect{|r| "#{r}_id"}
111
+ missing_methods = expected_method_names - resolver.methods.map(&:to_s)
112
+ missing_methods.must_equal []
113
+ end
114
+
115
+ describe "when no search options are found" do
116
+ let(:resolver_run) { proc { resolver.architecture_id({"option_unknown" => "value"}) } }
117
+
118
+ it "raises exception" do
119
+ err = resolver_run.must_raise HammerCLIForeman::MissingSeachOptions
120
+ end
121
+
122
+ it "builds correct error message" do
123
+ err = resolver_run.must_raise HammerCLIForeman::MissingSeachOptions
124
+ err.message.must_equal "Missing options to search architecture"
125
+ end
126
+ end
127
+
128
+ describe "searching independent resource" do
129
+ let(:resolver_run) { proc { resolver.architecture_id({"option_name" => "arch"}) } }
130
+
131
+ it "raises exception when no resource is found" do
132
+ ResourceMocks.mock_action_call(:architectures, :index, [])
133
+
134
+ err = resolver_run.must_raise HammerCLIForeman::ResolverError
135
+ err.message.must_equal "architecture not found"
136
+ end
137
+
138
+ it "raises exception when multiple resources are found" do
139
+ ResourceMocks.mock_action_call(:architectures, :index, [
140
+ {"id" => 11, "name" => "arch1"},
141
+ {"id" => 22, "name" => "arch2"}
142
+ ])
143
+
144
+ err = resolver_run.must_raise HammerCLIForeman::ResolverError
145
+ err.message.must_equal "architecture found more than once"
146
+ end
147
+
148
+ it "calls index action with appropriate search params" do
149
+ ApipieBindings::API.any_instance.expects(:call).with() do |resource, action, params, headers, opts|
150
+ ( resource == :architectures &&
151
+ action == :index &&
152
+ params[:search] == "name = \"arch\"")
153
+ end.returns({"id" => 11, "name" => "arch1"})
154
+
155
+ resolver_run.call
156
+ end
157
+
158
+ it "uses option id when it's available" do
159
+ ResourceMocks.mock_action_call(:architectures, :index, [])
160
+
161
+ resolver.architecture_id({"option_id" => 83, "option_name" => "arch"}).must_equal 83
162
+ end
163
+
164
+ it "returns id of the resource" do
165
+ ResourceMocks.mock_action_call(:architectures, :index, [
166
+ {"id" => 11, "name" => "arch1"}
167
+ ])
168
+
169
+ resolver_run.call.must_equal 11
170
+ end
171
+
172
+ end
173
+
174
+ describe "searching dependent resource" do
175
+ let(:resolver_run) { proc { resolver.image_id({"option_name" => "img", "option_compute_resource_name" => "cr"}) } }
176
+
177
+ it "raises exception when no resource is found" do
178
+ ResourceMocks.mock_action_call(:images, :index, [])
179
+ ResourceMocks.mock_action_call(:compute_resources, :index, [])
180
+
181
+ err = resolver_run.must_raise HammerCLIForeman::ResolverError
182
+ err.message.must_equal "compute_resource not found"
183
+ end
184
+
185
+ it "raises exception when multiple resources are found" do
186
+ ResourceMocks.mock_action_call(:images, :index, [])
187
+ ResourceMocks.mock_action_call(:compute_resources, :index, [
188
+ {"id" => 11, "name" => "cr1"},
189
+ {"id" => 22, "name" => "cr2"}
190
+ ])
191
+
192
+ err = resolver_run.must_raise HammerCLIForeman::ResolverError
193
+ err.message.must_equal "compute_resource found more than once"
194
+ end
195
+
196
+ it "calls index action with appropriate search params" do
197
+ ApipieBindings::API.any_instance.expects(:call).with() do |resource, action, params, headers, opts|
198
+ ( resource == :compute_resources &&
199
+ action == :index &&
200
+ params[:search] == "name = \"cr\"")
201
+ end.returns({"id" => 11, "name" => "cr"})
202
+
203
+ ApipieBindings::API.any_instance.expects(:call).with() do |resource, action, params, headers, opts|
204
+ ( resource == :images &&
205
+ action == :index &&
206
+ params[:search] == "name = \"img\"")
207
+ end.returns({"id" => 11, "name" => "img"})
208
+
209
+ resolver_run.call
210
+ end
211
+
212
+ it "returns id of the resource" do
213
+ ResourceMocks.mock_action_call(:images, :index, [
214
+ {"id" => 11, "name" => "img1"}
215
+ ])
216
+ ResourceMocks.mock_action_call(:compute_resources, :index, [
217
+ {"id" => 22, "name" => "cr2"}
218
+ ])
219
+
220
+ resolver_run.call.must_equal 11
221
+ end
222
+ end
223
+
224
+ end
225
+ end
@@ -7,11 +7,7 @@ require File.join(File.dirname(__FILE__), 'test_output_adapter')
7
7
  describe HammerCLIForeman::Image do
8
8
 
9
9
 
10
- extend CommandTestHelper
11
-
12
- before :each do
13
- cmd.stubs(:name_to_id).returns(1)
14
- end
10
+ include CommandTestHelper
15
11
 
16
12
  context "ListCommand" do
17
13
 
@@ -30,7 +26,7 @@ describe HammerCLIForeman::Image do
30
26
  it_should_print_n_records
31
27
  it_should_print_column "Id"
32
28
  it_should_print_column "Name"
33
- it_should_print_column "Operating System Id"
29
+ it_should_print_column "Operating System"
34
30
  it_should_print_column "Username"
35
31
  it_should_print_column "UUID"
36
32
  end
@@ -54,8 +50,8 @@ describe HammerCLIForeman::Image do
54
50
  it_should_print_n_records 1
55
51
  it_should_print_column "Id"
56
52
  it_should_print_column "Name"
57
- it_should_print_column "Operating System Id"
58
- it_should_print_column "Architecture Id"
53
+ it_should_print_column "Operating System"
54
+ it_should_print_column "Architecture"
59
55
  it_should_print_column "Username"
60
56
  it_should_print_column "UUID"
61
57
  it_should_print_column "IAM role"
@@ -72,7 +68,6 @@ describe HammerCLIForeman::Image do
72
68
  ResourceMocks.compute_resources_available_images
73
69
  end
74
70
 
75
-
76
71
  context "parameters" do
77
72
  it_should_accept "compute resource name", ["--compute-resource=cr"]
78
73
  it_should_accept "compute resource id", ["--compute-resource-id=1"]
@@ -93,11 +88,12 @@ describe HammerCLIForeman::Image do
93
88
  context "parameters" do
94
89
  it_should_accept "all required params", ["--name=img", "--operatingsystem-id=1", "--architecture-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource-id=1"]
95
90
  it_should_accept "all required params and resource's name", ["--name=img", "--operatingsystem-id=1", "--architecture-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource=ec2"]
96
- it_should_fail_with "name missing", ["--operatingsystem-id=1", "architecture-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource-id=1"]
97
- it_should_fail_with "os id missing", ["--name=img", "--operatingsystem-id=1", "architecture-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource-id=1"]
98
- it_should_fail_with "architecture id missing", ["--name=img", "--operatingsystem-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource-id=1"]
99
- it_should_fail_with "username id missing", ["--name=img", "--operatingsystem-id=1", "architecture-id=1", "--uuid=aabbcc123", "--compute-resource-id=1"]
100
- it_should_fail_with "uuid missing", ["--name=img", "--operatingsystem-id=1", "architecture-id=1", "--username=root", "--compute-resource-id=1"]
91
+ # it_should_fail_with "name missing", ["--operatingsystem-id=1", "architecture-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource-id=1"]
92
+ # it_should_fail_with "os id missing", ["--name=img", "--operatingsystem-id=1", "architecture-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource-id=1"]
93
+ # it_should_fail_with "architecture id missing", ["--name=img", "--operatingsystem-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource-id=1"]
94
+ # it_should_fail_with "username id missing", ["--name=img", "--operatingsystem-id=1", "architecture-id=1", "--uuid=aabbcc123", "--compute-resource-id=1"]
95
+ # it_should_fail_with "uuid missing", ["--name=img", "--operatingsystem-id=1", "architecture-id=1", "--username=root", "--compute-resource-id=1"]
96
+ # TODO: temporarily disabled, parameters are checked in the api
101
97
  end
102
98
 
103
99
  end
@@ -110,8 +106,9 @@ describe HammerCLIForeman::Image do
110
106
  context "parameters" do
111
107
  it_should_accept "id and resource's id", ["--id=1", "--compute-resource-id=1"]
112
108
  it_should_accept "id and resource's name", ["--id=1", "--compute-resource=ec2"]
113
- it_should_fail_with "id missing", ["--compute-resource-id=1"]
114
- it_should_fail_with "resource's id or name missing", ["--id=1"]
109
+ # it_should_fail_with "id missing", ["--compute-resource-id=1"]
110
+ # it_should_fail_with "resource's id or name missing", ["--id=1"]
111
+ # TODO: temporarily disabled, parameters are checked in the id resolver
115
112
  end
116
113
 
117
114
  end
@@ -125,8 +122,9 @@ describe HammerCLIForeman::Image do
125
122
  it_should_accept "id and resource's id", ["--id=1", "--compute-resource-id=1"]
126
123
  it_should_accept "id and resource's name", ["--id=1", "--compute-resource=ec2"]
127
124
  it_should_accept "all available params", ["--id=1", "--name=img", "--operatingsystem-id=1", "--architecture-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource-id=1"]
128
- it_should_fail_with "id missing", ["--compute-resource-id=1"]
129
- it_should_fail_with "resource's id or name missing", ["--id=1"]
125
+ # it_should_fail_with "id missing", ["--compute-resource-id=1"]
126
+ # it_should_fail_with "resource's id or name missing", ["--id=1"]
127
+ # TODO: temporarily disabled, parameters are checked in the id resolver
130
128
  end
131
129
 
132
130
  end
@@ -3,13 +3,9 @@ require File.join(File.dirname(__FILE__), 'helpers/resource_disabled')
3
3
 
4
4
  describe HammerCLIForeman::Location do
5
5
 
6
- extend CommandTestHelper
6
+ include CommandTestHelper
7
7
  extend ResourceDisabled
8
8
 
9
- before :each do
10
- cmd.stubs(:name_to_id).returns(1)
11
- end
12
-
13
9
  context "ListCommand" do
14
10
 
15
11
  let(:cmd) { HammerCLIForeman::Location::ListCommand.new("", ctx) }
@@ -46,7 +42,7 @@ describe HammerCLIForeman::Location do
46
42
  context "parameters" do
47
43
  it_should_accept "id", ["--id=1"]
48
44
  it_should_accept "name", ["--name=arch"]
49
- it_should_fail_with "no arguments"
45
+ # it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
50
46
  end
51
47
 
52
48
  context "output" do
@@ -71,7 +67,8 @@ describe HammerCLIForeman::Location do
71
67
 
72
68
  context "parameters" do
73
69
  it_should_accept "name", ["--name=org"]
74
- it_should_fail_with "name missing", []
70
+ # it_should_fail_with "name missing", []
71
+ # TODO: temporarily disabled, parameters are checked in the api
75
72
  end
76
73
 
77
74
  with_params ["--name=loc"] do
@@ -87,7 +84,7 @@ describe HammerCLIForeman::Location do
87
84
  context "parameters" do
88
85
  it_should_accept "name", ["--name=org"]
89
86
  it_should_accept "id", ["--id=1"]
90
- it_should_fail_with "name or id missing", []
87
+ # it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
91
88
  end
92
89
 
93
90
  with_params ["--id=1"] do
@@ -103,8 +100,9 @@ describe HammerCLIForeman::Location do
103
100
  context "parameters" do
104
101
  it_should_accept "name", ["--name=org", "--new-name=org2"]
105
102
  it_should_accept "id", ["--id=1", "--new-name=org2"]
106
- it_should_fail_with "no params", []
107
- it_should_fail_with "name or id missing", ["--new-name=org2"]
103
+ # it_should_fail_with "no params", []
104
+ # it_should_fail_with "name or id missing", ["--new-name=org2"]
105
+ # TODO: temporarily disabled, parameters are checked in the id resolver
108
106
  end
109
107
 
110
108
  with_params ["--id=1"] do