hammer_cli_foreman 3.0.0 → 3.3.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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/config/foreman.yml +4 -0
  3. data/doc/configuration.md +30 -0
  4. data/doc/release_notes.md +31 -0
  5. data/lib/hammer_cli_foreman/api/authenticator.rb +9 -0
  6. data/lib/hammer_cli_foreman/api/connection.rb +2 -0
  7. data/lib/hammer_cli_foreman/api/negotiate_auth.rb +36 -0
  8. data/lib/hammer_cli_foreman/api/session_authenticator_wrapper.rb +6 -2
  9. data/lib/hammer_cli_foreman/api.rb +2 -1
  10. data/lib/hammer_cli_foreman/auth.rb +13 -0
  11. data/lib/hammer_cli_foreman/command_extensions/domain.rb +20 -0
  12. data/lib/hammer_cli_foreman/command_extensions/subnet.rb +25 -10
  13. data/lib/hammer_cli_foreman/command_extensions/user.rb +9 -5
  14. data/lib/hammer_cli_foreman/command_extensions.rb +1 -0
  15. data/lib/hammer_cli_foreman/commands.rb +6 -3
  16. data/lib/hammer_cli_foreman/compute_attribute.rb +1 -1
  17. data/lib/hammer_cli_foreman/compute_resource/libvirt.rb +4 -2
  18. data/lib/hammer_cli_foreman/compute_resource/vmware.rb +4 -2
  19. data/lib/hammer_cli_foreman/compute_resource.rb +1 -0
  20. data/lib/hammer_cli_foreman/domain.rb +5 -28
  21. data/lib/hammer_cli_foreman/exception_handler.rb +26 -0
  22. data/lib/hammer_cli_foreman/filter.rb +3 -3
  23. data/lib/hammer_cli_foreman/host.rb +1 -0
  24. data/lib/hammer_cli_foreman/hostgroup.rb +13 -6
  25. data/lib/hammer_cli_foreman/hosts/common_update_options.rb +7 -7
  26. data/lib/hammer_cli_foreman/id_resolver.rb +7 -7
  27. data/lib/hammer_cli_foreman/option_builders.rb +65 -53
  28. data/lib/hammer_cli_foreman/option_sources/id_params.rb +21 -8
  29. data/lib/hammer_cli_foreman/option_sources/ids_params.rb +22 -9
  30. data/lib/hammer_cli_foreman/partition_table.rb +30 -0
  31. data/lib/hammer_cli_foreman/report_template.rb +15 -0
  32. data/lib/hammer_cli_foreman/smart_proxy.rb +18 -5
  33. data/lib/hammer_cli_foreman/template.rb +33 -15
  34. data/lib/hammer_cli_foreman/user.rb +5 -4
  35. data/lib/hammer_cli_foreman/version.rb +1 -1
  36. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  37. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  38. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  39. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  40. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  41. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  42. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  43. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  44. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  45. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  46. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  47. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  48. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  49. data/test/data/3.1/foreman_api.json +1 -0
  50. data/test/functional/compute_attribute_test.rb +20 -20
  51. data/test/functional/domain/create_test.rb +91 -0
  52. data/test/functional/domain/update_test.rb +90 -0
  53. data/test/functional/host_test.rb +34 -0
  54. data/test/functional/hostgroup/create_test.rb +11 -0
  55. data/test/functional/hostgroup/update_test.rb +11 -0
  56. data/test/functional/partition_table_test.rb +63 -0
  57. data/test/functional/personal_access_token_test.rb +4 -4
  58. data/test/functional/report_template_test.rb +24 -0
  59. data/test/functional/template_test.rb +134 -14
  60. data/test/functional/user_mail_notification_test.rb +3 -3
  61. data/test/test_helper.rb +1 -1
  62. data/test/unit/commands_test.rb +1 -2
  63. data/test/unit/option_builders_test.rb +88 -83
  64. data/test/unit/option_sources/id_params_test.rb +0 -9
  65. data/test/unit/option_sources/ids_params_test.rb +0 -9
  66. metadata +54 -44
@@ -77,6 +77,66 @@ describe 'template' do
77
77
  end
78
78
  end
79
79
 
80
+ describe 'import' do
81
+ let(:template) do
82
+ {
83
+ 'id' => 1,
84
+ 'template' => 'Template content'
85
+ }
86
+ end
87
+ let(:cmd) { %w(template import) }
88
+ let(:tempfile) { Tempfile.new('template') }
89
+
90
+ it 'requires --name and --file' do
91
+ params = ['--name=test']
92
+ api_expects_no_call
93
+ expected_result = usage_error_result(
94
+ cmd,
95
+ 'Options --name, --file are required.',
96
+ 'Could not import provisioning template')
97
+ result = run_cmd(cmd + params)
98
+ assert_cmd(expected_result, result)
99
+ end
100
+
101
+ it 'import template' do
102
+ params = ['--name=test', "--file=#{tempfile.path}"]
103
+ tempfile.write('Template content')
104
+ tempfile.rewind
105
+ api_expects(:provisioning_templates, :import, 'Import template').with_params(
106
+ 'provisioning_template' => {
107
+ 'name' => 'test',
108
+ 'template' => 'Template content'
109
+ }).returns(template)
110
+
111
+ result = run_cmd(cmd + params)
112
+ assert_cmd(success_result("Import provisioning template succeeded.\n"), result)
113
+ end
114
+ end
115
+
116
+ describe 'export' do
117
+ let(:cmd) { %w(template export) }
118
+ let(:tempfile) { Tempfile.new('template', '/tmp') }
119
+ let(:params) { ['--id=1', '--path=/tmp'] }
120
+ let(:template_response) do
121
+ response = mock('TemplateResponse')
122
+ response.stubs(:code).returns(200)
123
+ response.stubs(:body).returns('Template content')
124
+ response.stubs(:headers).returns({:content_disposition => "filename=\"#{File.basename(tempfile.path)}\""})
125
+ response
126
+ end
127
+
128
+ it 'download template' do
129
+ api_expects(:provisioning_templates, :export, 'Export template').with_params(
130
+ 'id' => '1').returns(template_response)
131
+
132
+ output = OutputMatcher.new("The provisioning template has been saved to #{tempfile.path}")
133
+ expected_result = success_result(output)
134
+ result = run_cmd(cmd + params)
135
+ assert_cmd(expected_result, result)
136
+ assert_equal('Template content', tempfile.read)
137
+ end
138
+ end
139
+
80
140
  describe 'update' do
81
141
  before do
82
142
  @cmd = %w(template update)
@@ -85,7 +145,6 @@ describe 'template' do
85
145
  it "doesn't send snippet flag when --type is undefined" do
86
146
  params = ['--id=1', '--locked=true']
87
147
 
88
- api_expects(:template_kinds, :index, 'Get list of template kinds').returns(index_response([]))
89
148
  api_expects(:provisioning_templates, :update, 'Update the template') do |par|
90
149
  par['id'] == '1' &&
91
150
  par['provisioning_template']['locked'] == true
@@ -99,7 +158,6 @@ describe 'template' do
99
158
  it 'updates nothing without template related parameters' do
100
159
  params = %w[--id=1 --organization-id=1 --location-id=1]
101
160
 
102
- api_expects(:template_kinds, :index, 'Get list of template kinds').returns(index_response([]))
103
161
  api_expects(:provisioning_templates, :update, 'Update template with no params').returns({})
104
162
 
105
163
  expected_result = success_result("Nothing to update.\n")
@@ -107,6 +165,48 @@ describe 'template' do
107
165
  result = run_cmd(@cmd + params)
108
166
  assert_cmd(expected_result, result)
109
167
  end
168
+
169
+ it 'should update a template' do
170
+ params = ['--id=1', '--type=snippet']
171
+
172
+ expected_result = CommandExpectation.new
173
+ expected_result.expected_out =
174
+ ['Provisioning template updated.',
175
+ ''].join("\n")
176
+ expected_result.expected_exit_code = HammerCLI::EX_OK
177
+
178
+ api_expects(:provisioning_templates, :update, 'Update template with params') do |p|
179
+ p['id'] == '1' && p['provisioning_template']['snippet'] == true
180
+ end
181
+
182
+ result = run_cmd(@cmd + params)
183
+ assert_cmd(expected_result, result)
184
+ end
185
+
186
+ it 'should update a template by name' do
187
+ params = ['--name=tpl', '--type=provision']
188
+
189
+ expected_result = CommandExpectation.new
190
+ expected_result.expected_out =
191
+ ['Provisioning template updated.',
192
+ ''].join("\n")
193
+ expected_result.expected_exit_code = HammerCLI::EX_OK
194
+
195
+ api_expects_search(:provisioning_templates, name: 'tpl').returns(
196
+ index_response([{ 'id' => '1' }])
197
+ )
198
+ api_expects_search(:template_kinds, name: 'provision').returns(
199
+ index_response([{ 'id' => '1' }])
200
+ )
201
+ api_expects(:provisioning_templates, :update, 'Update template with params') do |p|
202
+ p['id'] == '1' &&
203
+ p['provisioning_template']['snippet'] == false &&
204
+ p['provisioning_template']['template_kind_id'] == '1'
205
+ end
206
+
207
+ result = run_cmd(@cmd + params)
208
+ assert_cmd(expected_result, result)
209
+ end
110
210
  end
111
211
 
112
212
  describe 'create' do
@@ -120,15 +220,35 @@ describe 'template' do
120
220
  expected_result = CommandExpectation.new
121
221
  expected_result.expected_err =
122
222
  ['Could not create the provisioning template:',
123
- " Error: unknown template kind",
124
- ' ',
125
- " See: 'hammer template create --help'.",
223
+ ' Error: template_kind not found.',
126
224
  ''].join("\n")
127
- expected_result.expected_exit_code = HammerCLI::EX_USAGE
225
+ expected_result.expected_exit_code = HammerCLI::EX_SOFTWARE
128
226
 
129
- HammerCLIForeman::Template::CreateCommand.any_instance.stubs(:kinds).returns(["PXELinux"])
227
+ api_expects_search(:template_kinds, name: 'unknown').returns(
228
+ index_response([])
229
+ )
130
230
 
131
- api_expects_no_call
231
+ result = run_cmd(@cmd + params)
232
+ assert_cmd(expected_result, result)
233
+ end
234
+
235
+ it 'should create a template' do
236
+ params = ['--name=tpl', '--file=Gemfile', '--type=provision']
237
+
238
+ expected_result = CommandExpectation.new
239
+ expected_result.expected_out =
240
+ ['Provisioning template created.',
241
+ ''].join("\n")
242
+ expected_result.expected_exit_code = HammerCLI::EX_OK
243
+
244
+ api_expects_search(:template_kinds, name: 'provision').returns(
245
+ index_response([{ 'id' => '1' }])
246
+ )
247
+ api_expects(:provisioning_templates, :create, 'Create template with params') do |p|
248
+ p['provisioning_template']['name'] == 'tpl' &&
249
+ p['provisioning_template']['snippet'] == false &&
250
+ p['provisioning_template']['template_kind_id'] = '1'
251
+ end
132
252
 
133
253
  result = run_cmd(@cmd + params)
134
254
  assert_cmd(expected_result, result)
@@ -144,9 +264,9 @@ describe 'template' do
144
264
  params = ['create','--provisioning-template-id=10', '--hostgroup-id=1']
145
265
  expected_result = success_result("Template combination created.\n")
146
266
  api_expects(:template_combinations, :create, 'Create template combination') do |params|
147
- params['provisioning_template_id'] == 10 &&
148
- params['hostgroup_id'] == 1 &&
149
- params['template_combination'] == {'hostgroup_id' => 1}
267
+ params['provisioning_template_id'] == '10' &&
268
+ params['hostgroup_id'] == '1' &&
269
+ params['template_combination'] == { 'hostgroup_id' => '1' }
150
270
  end
151
271
 
152
272
  result = run_cmd(@cmd + params)
@@ -158,9 +278,9 @@ describe 'template' do
158
278
  expected_result = success_result("Template combination updated.\n")
159
279
  api_expects(:template_combinations, :update, 'Update template combination') do |params|
160
280
  params['id'] == '3' &&
161
- params['provisioning_template_id'] == 10 &&
162
- params['hostgroup_id'] == 1 &&
163
- params['template_combination'] == { 'hostgroup_id' => 1 }
281
+ params['provisioning_template_id'] == '10' &&
282
+ params['hostgroup_id'] == '1' &&
283
+ params['template_combination'] == { 'hostgroup_id' => '1' }
164
284
  end
165
285
 
166
286
  result = run_cmd(@cmd + params)
@@ -55,9 +55,9 @@ describe 'user_mail_notification' do
55
55
  params = ['--user-id=2']
56
56
 
57
57
  expected_result = common_error_result(
58
- @cmd,
59
- "Could not find mail_notification, please set one of options --mail-notification, --mail-notification-id.",
60
- "Could not add user mail notification"
58
+ @cmd,
59
+ 'Could not find mail_notification, please set one of options --mail-notification-id, --mail-notification.',
60
+ 'Could not add user mail notification'
61
61
  )
62
62
 
63
63
  result = run_cmd(@cmd + params)
data/test/test_helper.rb CHANGED
@@ -17,7 +17,7 @@ require "mocha/minitest"
17
17
  require 'hammer_cli'
18
18
  require 'hammer_cli_foreman/testing/api_expectations'
19
19
 
20
- FOREMAN_VERSION = ENV['TEST_API_VERSION'] || '2.5'
20
+ FOREMAN_VERSION = ENV['TEST_API_VERSION'] || '3.1'
21
21
  unless Dir.entries('test/data').include? FOREMAN_VERSION
22
22
  raise StandardError.new "Version is not correct"
23
23
  end
@@ -183,8 +183,7 @@ describe HammerCLIForeman::Command do
183
183
  out, err = capture_io do
184
184
  _(com.run(['--location', 'loc'])).wont_equal HammerCLI::EX_OK
185
185
  end
186
- _(err).must_equal "Error: Could not find location, please set one of options --location, --location-title, --location-id.\n"
187
-
186
+ _(err).must_equal "Error: Could not find location, please set one of options --location-id, --location, --location-title.\n"
188
187
  end
189
188
 
190
189
  it "ignores error on attempt to search of parameters that are not required" do
@@ -209,7 +209,9 @@ describe HammerCLIForeman::ForemanOptionBuilder do
209
209
  end
210
210
 
211
211
  context "dependent searchables options expansion" do
212
- let(:option_switches) { container.build(@build_options).map(&:switches) }
212
+ let(:option_switches) do
213
+ container.build(@build_options.merge(command: Class.new(HammerCLIForeman::Command))).map(&:switches)
214
+ end
213
215
 
214
216
  before :each do
215
217
  container.builders = [
@@ -218,51 +220,51 @@ describe HammerCLIForeman::ForemanOptionBuilder do
218
220
  ]
219
221
  end
220
222
 
221
- it "does not filter searchable builders by default" do
222
- @build_options = {:expand => {}}
223
+ it 'does not filter searchable builders by default' do
224
+ @build_options = { expand: {} }
223
225
  _(option_switches).must_equal [
224
- ["--user"],
225
- ["--user-label"],
226
- ["--user-id"],
227
- ["--post"],
228
- ["--post-label"],
229
- ["--post-id"]
226
+ ['--user-id'],
227
+ ['--user'],
228
+ ['--user-label'],
229
+ ['--post-id'],
230
+ ['--post'],
231
+ ['--post-label']
230
232
  ]
231
233
  end
232
234
 
233
- it "adds dependent searchable builders on explicit requirement" do
234
- @build_options = {:expand => {:including => [:posts, :comments]}}
235
+ it 'adds dependent searchable builders on explicit requirement' do
236
+ @build_options = { expand: { including: %i[posts comments] } }
235
237
  _(option_switches).must_equal [
236
- ["--user"],
237
- ["--user-label"],
238
- ["--user-id"],
239
- ["--post"],
240
- ["--post-label"],
241
- ["--post-id"],
242
- ["--comment"],
243
- ["--comment-label"],
244
- ["--comment-id"]
238
+ ['--user-id'],
239
+ ['--user'],
240
+ ['--user-label'],
241
+ ['--post-id'],
242
+ ['--post'],
243
+ ['--post-label'],
244
+ ['--comment-id'],
245
+ ['--comment'],
246
+ ['--comment-label']
245
247
  ]
246
248
  end
247
249
 
248
- it "filters dependent searchable builders on explicit requirement" do
249
- @build_options = {:expand => {:except => [:users]}}
250
+ it 'filters dependent searchable builders on explicit requirement' do
251
+ @build_options = { expand: { except: [:users] } }
250
252
  _(option_switches).must_equal [
251
- ["--post"],
252
- ["--post-label"],
253
- ["--post-id"]
253
+ ['--post-id'],
254
+ ['--post'],
255
+ ['--post-label']
254
256
  ]
255
257
  end
256
258
 
257
- it "specifies custom set of dependent searchable builders on explicit requirement" do
258
- @build_options = {:expand => {:only => [:comments, :users]}}
259
+ it 'specifies custom set of dependent searchable builders on explicit requirement' do
260
+ @build_options = { expand: { only: %i[comments users] } }
259
261
  _(option_switches).must_equal [
260
- ["--user"],
261
- ["--user-label"],
262
- ["--user-id"],
263
- ["--comment"],
264
- ["--comment-label"],
265
- ["--comment-id"]
262
+ ['--user-id'],
263
+ ['--user'],
264
+ ['--user-label'],
265
+ ['--comment-id'],
266
+ ['--comment'],
267
+ ['--comment-label']
266
268
  ]
267
269
  end
268
270
  end
@@ -327,7 +329,7 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
327
329
  let(:resource) { api.resource(:users) }
328
330
  let(:searchables) { FakeSearchables.new(["name", "label", "uuid"]) }
329
331
  let(:builder) { HammerCLIForeman::DependentSearchablesOptionBuilder.new(resource, searchables) }
330
- let(:builder_params) { {} }
332
+ let(:builder_params) { { command: Class.new(HammerCLIForeman::Command) } }
331
333
  let(:options) { builder.build(builder_params) }
332
334
 
333
335
  describe "empty searchables" do
@@ -339,41 +341,40 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
339
341
  end
340
342
  end
341
343
 
342
- describe "multiple searchables" do
343
-
344
- it "creates correct switches" do
344
+ describe 'multiple searchables' do
345
+ it 'creates correct switches' do
345
346
  _(options.map(&:switches)).must_equal [
346
- ["--user"], # first option does not have the suffix
347
- ["--user-label"], # other options with suffixes
348
- ["--user-uuid"],
349
- ["--user-id"] # additional id
347
+ ['--user-id'], # main option from API docs
348
+ ['--user'], # additional option
349
+ ['--user-label'], # other options with suffixes
350
+ ['--user-uuid']
350
351
  ]
351
352
  end
352
353
 
353
- it "creates correct option types" do
354
- _(options.map(&:type)).must_equal [
355
- "USER_NAME",
356
- "USER_LABEL",
357
- "USER_UUID",
358
- "USER_ID",
354
+ it 'creates correct option types' do
355
+ _(options.map(&:type)).must_equal %w[
356
+ USER_ID
357
+ USER_NAME
358
+ USER_LABEL
359
+ USER_UUID
359
360
  ]
360
361
  end
361
362
 
362
- it "creates correct descriptions" do
363
+ it 'creates correct descriptions' do
363
364
  _(options.map(&:description)).must_equal [
364
- "Search by name",
365
- "Search by label",
366
- "Search by uuid",
367
- "DESC"
365
+ 'DESC',
366
+ 'Search by name',
367
+ 'Search by label',
368
+ 'Search by uuid'
368
369
  ]
369
370
  end
370
371
 
371
- it "creates correct attribute readers" do
372
- _(options.map(&:read_method)).must_equal [
373
- "option_user_name",
374
- "option_user_label",
375
- "option_user_uuid",
376
- "option_user_id",
372
+ it 'creates correct attribute readers' do
373
+ _(options.map(&:read_method)).must_equal %w[
374
+ option_user_id
375
+ option_user_name
376
+ option_user_label
377
+ option_user_uuid
377
378
  ]
378
379
  end
379
380
 
@@ -385,44 +386,48 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
385
386
 
386
387
  describe "aliasing resource names" do
387
388
 
388
- let(:builder_params) { {:resource_mapping => {:user => :usr}} }
389
+ let(:builder_params) do
390
+ {
391
+ resource_mapping: { user: :usr },
392
+ command: Class.new(HammerCLIForeman::Command)
393
+ }
394
+ end
389
395
 
390
- it "renames options" do
396
+ it 'renames options' do
391
397
  _(options.map(&:switches)).must_equal [
392
- ["--usr"], # first option does not have the suffix
393
- ["--usr-label"], # other options with suffixes
394
- ["--usr-uuid"],
395
- ["--usr-id"] # additional id
398
+ ['--usr-id'], # parent option id
399
+ ['--usr'], # additional option
400
+ ['--usr-label'], # other options with suffixes
401
+ ['--usr-uuid']
396
402
  ]
397
403
  end
398
404
 
399
- it "renames option types" do
400
- _(options.map(&:type)).must_equal [
401
- "USR_NAME",
402
- "USR_LABEL",
403
- "USR_UUID",
404
- "USR_ID",
405
+ it 'renames option types' do
406
+ _(options.map(&:type)).must_equal %w[
407
+ USR_ID
408
+ USR_NAME
409
+ USR_LABEL
410
+ USR_UUID
405
411
  ]
406
412
  end
407
413
 
408
- it "keeps option accessor the same" do
409
- _(options.map(&:attribute_name)).must_equal [
410
- "option_user_name",
411
- "option_user_label",
412
- "option_user_uuid",
413
- "option_user_id"
414
+ it 'keeps option accessor the same' do
415
+ _(options.map(&:attribute_name)).must_equal %w[
416
+ option_user_id
417
+ option_user_name
418
+ option_user_label
419
+ option_user_uuid
414
420
  ]
415
421
  end
416
422
  end
417
423
 
418
- describe "resources with id parameter in show action" do
419
-
420
- it "uses descriptions from the action" do
424
+ describe 'resources with id parameter in show action' do
425
+ it 'uses descriptions from the action' do
421
426
  _(options.map(&:description)).must_equal [
422
- "Search by name",
423
- "Search by label",
424
- "Search by uuid",
425
- "DESC"
427
+ 'DESC',
428
+ 'Search by name',
429
+ 'Search by label',
430
+ 'Search by uuid'
426
431
  ]
427
432
  end
428
433
  end
@@ -26,14 +26,5 @@ describe HammerCLIForeman::OptionSources::IdParams do
26
26
  params = id_params_source.get_options([], option_data)
27
27
  _(params).must_equal expected_data
28
28
  end
29
-
30
- it 'resolves param when set but different name' do
31
- hg_cmd.stubs(:get_resource_id).returns(nil)
32
- hg_cmd.expects(:get_resource_id).with { |res| res.name == :domains }.returns(3)
33
- option_data = { 'option_domain_id' => 1, 'option_domain_name' => 'test3' }
34
- expected_data = { 'option_domain_id' => 3, 'option_domain_name' => 'test3' }
35
- params = id_params_source.get_options([], option_data)
36
- _(params).must_equal expected_data
37
- end
38
29
  end
39
30
  end
@@ -26,14 +26,5 @@ describe HammerCLIForeman::OptionSources::IdsParams do
26
26
  params = ids_params_source.get_options([], option_data)
27
27
  _(params).must_equal expected_data
28
28
  end
29
-
30
- it "resolves param when set but different name" do
31
- cmd.stubs(:get_resource_ids).returns(nil)
32
- cmd.expects(:get_resource_ids).with { |res| res.name == :locations }.returns([3])
33
- option_data = { 'option_location_ids' => [1], 'option_location_names' => 'test3' }
34
- expected_data = { 'option_location_ids' => [3], 'option_location_names' => 'test3' }
35
- params = ids_params_source.get_options([], option_data)
36
- _(params).must_equal expected_data
37
- end
38
29
  end
39
30
  end