@@ -66,8 +66,7 @@ def test_volume_type_set_unset_properties(self):
6666 cmd_output = json .loads (self .openstack (
6767 'volume type show -f json %s' % name
6868 ))
69- # TODO(amotoki): properties output should be machine-readable
70- self .assertEqual ("a='b', c='d'" , cmd_output ['properties' ])
69+ self .assertEqual ({'a' : 'b' , 'c' : 'd' }, cmd_output ['properties' ])
7170
7271 raw_output = self .openstack (
7372 'volume type unset --property a %s' % name
@@ -76,7 +75,7 @@ def test_volume_type_set_unset_properties(self):
7675 cmd_output = json .loads (self .openstack (
7776 'volume type show -f json %s' % name
7877 ))
79- self .assertEqual ("c='d'" , cmd_output ['properties' ])
78+ self .assertEqual ({ 'c' : 'd' } , cmd_output ['properties' ])
8079
8180 def test_volume_type_set_unset_multiple_properties (self ):
8281 name = uuid .uuid4 ().hex
@@ -97,7 +96,7 @@ def test_volume_type_set_unset_multiple_properties(self):
9796 cmd_output = json .loads (self .openstack (
9897 'volume type show -f json %s' % name
9998 ))
100- self .assertEqual ("a=' b', c='d'" , cmd_output ['properties' ])
99+ self .assertEqual ({ 'a' : ' b' , 'c' : 'd' } , cmd_output ['properties' ])
101100
102101 raw_output = self .openstack (
103102 'volume type unset --property a --property c %s' % name
@@ -106,7 +105,7 @@ def test_volume_type_set_unset_multiple_properties(self):
106105 cmd_output = json .loads (self .openstack (
107106 'volume type show -f json %s' % name
108107 ))
109- self .assertEqual ("" , cmd_output ['properties' ])
108+ self .assertEqual ({} , cmd_output ['properties' ])
110109
111110 def test_multi_delete (self ):
112111 vol_type1 = uuid .uuid4 ().hex
@@ -133,34 +132,32 @@ def test_encryption_type(self):
133132 '--encryption-key-size 128 '
134133 '--encryption-control-location front-end ' +
135134 encryption_type ))
136- # TODO(amotoki): encryption output should be machine-readable
137- expected = ["provider='LuksEncryptor'" ,
138- "cipher='aes-xts-plain64'" ,
139- "key_size='128'" ,
140- "control_location='front-end'" ]
141- for attr in expected :
142- self .assertIn (attr , cmd_output ['encryption' ])
135+ expected = {'provider' : 'LuksEncryptor' ,
136+ 'cipher' : 'aes-xts-plain64' ,
137+ 'key_size' : 128 ,
138+ 'control_location' : 'front-end' }
139+ for attr , value in expected .items ():
140+ self .assertEqual (value , cmd_output ['encryption' ][attr ])
143141 # test show encryption type
144142 cmd_output = json .loads (self .openstack (
145143 'volume type show -f json --encryption-type ' + encryption_type ))
146- expected = [ " provider=' LuksEncryptor'" ,
147- " cipher=' aes-xts-plain64'" ,
148- " key_size=' 128'" ,
149- " control_location=' front-end'" ]
150- for attr in expected :
151- self .assertIn ( attr , cmd_output ['encryption' ])
144+ expected = { ' provider' : ' LuksEncryptor' ,
145+ ' cipher' : ' aes-xts-plain64' ,
146+ ' key_size' : 128 ,
147+ ' control_location' : ' front-end'}
148+ for attr , value in expected . items () :
149+ self .assertEqual ( value , cmd_output ['encryption' ][ attr ])
152150 # test list encryption type
153151 cmd_output = json .loads (self .openstack (
154152 'volume type list -f json --encryption-type' ))
155153 encryption_output = [t ['Encryption' ] for t in cmd_output
156154 if t ['Name' ] == encryption_type ][0 ]
157- # TODO(amotoki): encryption output should be machine-readable
158- expected = ["provider='LuksEncryptor'" ,
159- "cipher='aes-xts-plain64'" ,
160- "key_size='128'" ,
161- "control_location='front-end'" ]
162- for attr in expected :
163- self .assertIn (attr , encryption_output )
155+ expected = {'provider' : 'LuksEncryptor' ,
156+ 'cipher' : 'aes-xts-plain64' ,
157+ 'key_size' : 128 ,
158+ 'control_location' : 'front-end' }
159+ for attr , value in expected .items ():
160+ self .assertEqual (value , encryption_output [attr ])
164161 # test set new encryption type
165162 raw_output = self .openstack (
166163 'volume type set '
@@ -185,12 +182,12 @@ def test_encryption_type(self):
185182 cmd_output = json .loads (self .openstack (
186183 'volume type show -f json --encryption-type ' + name
187184 ))
188- expected = [ " provider=' LuksEncryptor'" ,
189- " cipher=' aes-xts-plain64'" ,
190- " key_size=' 128'" ,
191- " control_location=' front-end'" ]
192- for attr in expected :
193- self .assertIn ( attr , cmd_output ['encryption' ])
185+ expected = { ' provider' : ' LuksEncryptor' ,
186+ ' cipher' : ' aes-xts-plain64' ,
187+ ' key_size' : 128 ,
188+ ' control_location' : ' front-end'}
189+ for attr , value in expected . items () :
190+ self .assertEqual ( value , cmd_output ['encryption' ][ attr ])
194191 # test unset encryption type
195192 raw_output = self .openstack (
196193 'volume type unset --encryption-type ' + name
@@ -199,7 +196,7 @@ def test_encryption_type(self):
199196 cmd_output = json .loads (self .openstack (
200197 'volume type show -f json --encryption-type ' + name
201198 ))
202- self .assertEqual ('' , cmd_output ['encryption' ])
199+ self .assertEqual ({} , cmd_output ['encryption' ])
203200 # test delete encryption type
204201 raw_output = self .openstack ('volume type delete ' + encryption_type )
205202 self .assertEqual ('' , raw_output )
0 commit comments