@@ -74,7 +74,7 @@ func (s *DefaultsCommandSuite) TestDefaultsInit(c *gc.C) {
74
74
{
75
75
description : "test reset with valid region and extra positional arg" ,
76
76
args : []string {"--reset" , "something" , "dummy-region" , "weird" },
77
- errorMatch : "cannot retrieve defaults for a key and reset args at the same time" ,
77
+ errorMatch : "cannot retrieve defaults for a region and reset attributes at the same time" ,
78
78
}, {
79
79
description : "test reset with valid region only" ,
80
80
args : []string {"--reset" , "foo" , "dummy-region" },
@@ -151,11 +151,11 @@ func (s *DefaultsCommandSuite) TestDefaultsInit(c *gc.C) {
151
151
}, {
152
152
description : "test valid region and one arg" ,
153
153
args : []string {"dummy-region" , "one" },
154
- errorMatch : "specifying a region when retrieving defaults for a setting is invalid" ,
154
+ nilErr : true ,
155
155
}, {
156
156
description : "test valid region and no args" ,
157
157
args : []string {"dummy-region" },
158
- errorMatch : "specifying a region when retrieving defaults is invalid" ,
158
+ nilErr : true ,
159
159
}, {
160
160
// test cloud/region
161
161
description : "test invalid cloud fails" ,
@@ -242,6 +242,9 @@ func (s *DefaultsCommandSuite) TestResetAttr(c *gc.C) {
242
242
"attr2" : {Controller : "bar" , Default : nil , Regions : []config.RegionDefaultValue {{
243
243
Name : "dummy-region" ,
244
244
Value : "dummy-value" ,
245
+ }, {
246
+ Name : "another-region" ,
247
+ Value : "another-value" ,
245
248
}}},
246
249
})
247
250
}
@@ -267,6 +270,9 @@ func (s *DefaultsCommandSuite) TestSet(c *gc.C) {
267
270
"attr2" : {Controller : "bar" , Default : nil , Regions : []config.RegionDefaultValue {{
268
271
Name : "dummy-region" ,
269
272
Value : "dummy-value" ,
273
+ }, {
274
+ Name : "another-region" ,
275
+ Value : "another-value" ,
270
276
}}},
271
277
"special" : {Controller : "extra" , Default : nil , Regions : nil },
272
278
})
@@ -307,9 +313,10 @@ func (s *DefaultsCommandSuite) TestGetSingleValue(c *gc.C) {
307
313
308
314
output := strings .TrimSpace (testing .Stdout (context ))
309
315
expected := "" +
310
- "Attribute Default Controller\n " +
311
- "attr2 - bar\n " +
312
- " dummy-region dummy-value -"
316
+ "Attribute Default Controller\n " +
317
+ "attr2 - bar\n " +
318
+ " dummy-region dummy-value -\n " +
319
+ " another-region another-value -"
313
320
c .Assert (output , gc .Equals , expected )
314
321
}
315
322
@@ -319,7 +326,7 @@ func (s *DefaultsCommandSuite) TestGetSingleValueJSON(c *gc.C) {
319
326
320
327
output := strings .TrimSpace (testing .Stdout (context ))
321
328
c .Assert (output , gc .Equals ,
322
- `{"attr2":{"controller":"bar","regions":[{"name":"dummy-region","value":"dummy-value"}]}}` )
329
+ `{"attr2":{"controller":"bar","regions":[{"name":"dummy-region","value":"dummy-value"},{"name":"another-region","value":"another-value"} ]}}` )
323
330
}
324
331
325
332
func (s * DefaultsCommandSuite ) TestGetAllValuesYAML (c * gc.C ) {
@@ -334,7 +341,9 @@ func (s *DefaultsCommandSuite) TestGetAllValuesYAML(c *gc.C) {
334
341
" controller: bar\n " +
335
342
" regions:\n " +
336
343
" - name: dummy-region\n " +
337
- " value: dummy-value"
344
+ " value: dummy-value\n " +
345
+ " - name: another-region\n " +
346
+ " value: another-value"
338
347
c .Assert (output , gc .Equals , expected )
339
348
}
340
349
@@ -343,18 +352,31 @@ func (s *DefaultsCommandSuite) TestGetAllValuesJSON(c *gc.C) {
343
352
c .Assert (err , jc .ErrorIsNil )
344
353
345
354
output := strings .TrimSpace (testing .Stdout (context ))
346
- expected := `{"attr":{"default":"foo"},"attr2":{"controller":"bar","regions":[{"name":"dummy-region","value":"dummy-value"}]}}`
355
+ expected := `{"attr":{"default":"foo"},"attr2":{"controller":"bar","regions":[{"name":"dummy-region","value":"dummy-value"},{"name":"another-region","value":"another-value"} ]}}`
347
356
c .Assert (output , gc .Equals , expected )
348
357
}
349
358
350
359
func (s * DefaultsCommandSuite ) TestGetAllValuesTabular (c * gc.C ) {
351
360
context , err := s .run (c )
352
361
c .Assert (err , jc .ErrorIsNil )
353
362
363
+ output := strings .TrimSpace (testing .Stdout (context ))
364
+ expected := "" +
365
+ "Attribute Default Controller\n " +
366
+ "attr foo -\n " +
367
+ "attr2 - bar\n " +
368
+ " dummy-region dummy-value -\n " +
369
+ " another-region another-value -"
370
+ c .Assert (output , gc .Equals , expected )
371
+ }
372
+
373
+ func (s * DefaultsCommandSuite ) TestGetRegionValuesTabular (c * gc.C ) {
374
+ context , err := s .run (c , "dummy-region" )
375
+ c .Assert (err , jc .ErrorIsNil )
376
+
354
377
output := strings .TrimSpace (testing .Stdout (context ))
355
378
expected := "" +
356
379
"Attribute Default Controller\n " +
357
- "attr foo -\n " +
358
380
"attr2 - bar\n " +
359
381
" dummy-region dummy-value -"
360
382
c .Assert (output , gc .Equals , expected )
0 commit comments