@@ -65,8 +65,7 @@ def test_volume_type_set_unset_properties(self):
6565 cmd_output = json .loads (self .openstack (
6666 'volume type show -f json %s' % name
6767 ))
68- # TODO(amotoki): properties output should be machine-readable
69- self .assertEqual ("a='b', c='d'" , cmd_output ['properties' ])
68+ self .assertEqual ({'a' : 'b' , 'c' : 'd' }, cmd_output ['properties' ])
7069
7170 raw_output = self .openstack (
7271 'volume type unset --property a %s' % name
@@ -75,7 +74,7 @@ def test_volume_type_set_unset_properties(self):
7574 cmd_output = json .loads (self .openstack (
7675 'volume type show -f json %s' % name
7776 ))
78- self .assertEqual ("c='d'" , cmd_output ['properties' ])
77+ self .assertEqual ({ 'c' : 'd' } , cmd_output ['properties' ])
7978
8079 def test_volume_type_set_unset_multiple_properties (self ):
8180 name = uuid .uuid4 ().hex
@@ -96,7 +95,7 @@ def test_volume_type_set_unset_multiple_properties(self):
9695 cmd_output = json .loads (self .openstack (
9796 'volume type show -f json %s' % name
9897 ))
99- self .assertEqual ("a=' b', c='d'" , cmd_output ['properties' ])
98+ self .assertEqual ({ 'a' : ' b' , 'c' : 'd' } , cmd_output ['properties' ])
10099
101100 raw_output = self .openstack (
102101 'volume type unset --property a --property c %s' % name
@@ -105,7 +104,7 @@ def test_volume_type_set_unset_multiple_properties(self):
105104 cmd_output = json .loads (self .openstack (
106105 'volume type show -f json %s' % name
107106 ))
108- self .assertEqual ("" , cmd_output ['properties' ])
107+ self .assertEqual ({} , cmd_output ['properties' ])
109108
110109 def test_volume_type_set_unset_project (self ):
111110 name = uuid .uuid4 ().hex
@@ -155,35 +154,32 @@ def test_encryption_type(self):
155154 '--encryption-key-size 128 '
156155 '--encryption-control-location front-end ' +
157156 encryption_type ))
158- # TODO(amotoki): encryption output should be machine-readable
159- expected = ["provider='LuksEncryptor'" ,
160- "cipher='aes-xts-plain64'" ,
161- "key_size='128'" ,
162- "control_location='front-end'" ]
163- for attr in expected :
164- self .assertIn (attr , cmd_output ['encryption' ])
157+ expected = {'provider' : 'LuksEncryptor' ,
158+ 'cipher' : 'aes-xts-plain64' ,
159+ 'key_size' : 128 ,
160+ 'control_location' : 'front-end' }
161+ for attr , value in expected .items ():
162+ self .assertEqual (value , cmd_output ['encryption' ][attr ])
165163 # test show encryption type
166164 cmd_output = json .loads (self .openstack (
167165 'volume type show -f json --encryption-type ' + encryption_type ))
168- # TODO(amotoki): encryption output should be machine-readable
169- expected = ["provider='LuksEncryptor'" ,
170- "cipher='aes-xts-plain64'" ,
171- "key_size='128'" ,
172- "control_location='front-end'" ]
173- for attr in expected :
174- self .assertIn (attr , cmd_output ['encryption' ])
166+ expected = {'provider' : 'LuksEncryptor' ,
167+ 'cipher' : 'aes-xts-plain64' ,
168+ 'key_size' : 128 ,
169+ 'control_location' : 'front-end' }
170+ for attr , value in expected .items ():
171+ self .assertEqual (value , cmd_output ['encryption' ][attr ])
175172 # test list encryption type
176173 cmd_output = json .loads (self .openstack (
177174 'volume type list -f json --encryption-type' ))
178175 encryption_output = [t ['Encryption' ] for t in cmd_output
179176 if t ['Name' ] == encryption_type ][0 ]
180- # TODO(amotoki): encryption output should be machine-readable
181- expected = ["provider='LuksEncryptor'" ,
182- "cipher='aes-xts-plain64'" ,
183- "key_size='128'" ,
184- "control_location='front-end'" ]
185- for attr in expected :
186- self .assertIn (attr , encryption_output )
177+ expected = {'provider' : 'LuksEncryptor' ,
178+ 'cipher' : 'aes-xts-plain64' ,
179+ 'key_size' : 128 ,
180+ 'control_location' : 'front-end' }
181+ for attr , value in expected .items ():
182+ self .assertEqual (value , encryption_output [attr ])
187183 # test set existing encryption type
188184 raw_output = self .openstack (
189185 'volume type set '
@@ -193,12 +189,12 @@ def test_encryption_type(self):
193189 self .assertEqual ('' , raw_output )
194190 cmd_output = json .loads (self .openstack (
195191 'volume type show -f json --encryption-type ' + encryption_type ))
196- expected = [ " provider=' LuksEncryptor'" ,
197- " cipher=' aes-xts-plain64'" ,
198- " key_size=' 256'" ,
199- " control_location=' back-end'" ]
200- for attr in expected :
201- self .assertIn ( attr , cmd_output ['encryption' ])
192+ expected = { ' provider' : ' LuksEncryptor' ,
193+ ' cipher' : ' aes-xts-plain64' ,
194+ ' key_size' : 256 ,
195+ ' control_location' : ' back-end'}
196+ for attr , value in expected . items () :
197+ self .assertEqual ( value , cmd_output ['encryption' ][ attr ])
202198 # test set new encryption type
203199 cmd_output = json .loads (self .openstack (
204200 'volume type create -f json --private ' +
@@ -222,12 +218,12 @@ def test_encryption_type(self):
222218 cmd_output = json .loads (self .openstack (
223219 'volume type show -f json --encryption-type ' + name
224220 ))
225- expected = [ " provider=' LuksEncryptor'" ,
226- " cipher=' aes-xts-plain64'" ,
227- " key_size=' 128'" ,
228- " control_location=' front-end'" ]
229- for attr in expected :
230- self .assertIn ( attr , cmd_output ['encryption' ])
221+ expected = { ' provider' : ' LuksEncryptor' ,
222+ ' cipher' : ' aes-xts-plain64' ,
223+ ' key_size' : 128 ,
224+ ' control_location' : ' front-end'}
225+ for attr , value in expected . items () :
226+ self .assertEqual ( value , cmd_output ['encryption' ][ attr ])
231227 # test unset encryption type
232228 raw_output = self .openstack (
233229 'volume type unset --encryption-type ' + name
@@ -236,7 +232,7 @@ def test_encryption_type(self):
236232 cmd_output = json .loads (self .openstack (
237233 'volume type show -f json --encryption-type ' + name
238234 ))
239- self .assertEqual ('' , cmd_output ['encryption' ])
235+ self .assertEqual ({} , cmd_output ['encryption' ])
240236 # test delete encryption type
241237 raw_output = self .openstack ('volume type delete ' + encryption_type )
242238 self .assertEqual ('' , raw_output )
0 commit comments