@@ -58,30 +58,29 @@ def test_volume_type_set_unset_properties(self):
5858 self .assertEqual ("" , raw_output )
5959 cmd_output = json .loads (self .openstack (
6060 'volume type show -f json ' + self .NAME ))
61- # TODO(amotoki): properties output should be machine-readable
62- self .assertEqual ("a='b', c='d'" , cmd_output ['properties' ])
61+ self .assertEqual ({'a' : 'b' , 'c' : 'd' }, cmd_output ['properties' ])
6362
6463 raw_output = self .openstack ('volume type unset --property a '
6564 + self .NAME )
6665 self .assertEqual ("" , raw_output )
6766 cmd_output = json .loads (self .openstack (
6867 'volume type show -f json ' + self .NAME ))
69- self .assertEqual ("c='d'" , cmd_output ['properties' ])
68+ self .assertEqual ({ 'c' : 'd' } , cmd_output ['properties' ])
7069
7170 def test_volume_type_set_unset_multiple_properties (self ):
7271 raw_output = self .openstack (
7372 'volume type set --property a=b --property c=d ' + self .NAME )
7473 self .assertEqual ("" , raw_output )
7574 cmd_output = json .loads (self .openstack (
7675 'volume type show -f json ' + self .NAME ))
77- self .assertEqual ("a=' b', c='d'" , cmd_output ['properties' ])
76+ self .assertEqual ({ 'a' : ' b' , 'c' : 'd' } , cmd_output ['properties' ])
7877
7978 raw_output = self .openstack (
8079 'volume type unset --property a --property c ' + self .NAME )
8180 self .assertEqual ("" , raw_output )
8281 cmd_output = json .loads (self .openstack (
8382 'volume type show -f json ' + self .NAME ))
84- self .assertEqual ("" , cmd_output ['properties' ])
83+ self .assertEqual ({} , cmd_output ['properties' ])
8584
8685 def test_volume_type_set_unset_project (self ):
8786 raw_output = self .openstack (
@@ -117,35 +116,32 @@ def test_encryption_type(self):
117116 '--encryption-key-size 128 '
118117 '--encryption-control-location front-end ' +
119118 encryption_type ))
120- # TODO(amotoki): encryption output should be machine-readable
121- expected = ["provider='LuksEncryptor'" ,
122- "cipher='aes-xts-plain64'" ,
123- "key_size='128'" ,
124- "control_location='front-end'" ]
125- for attr in expected :
126- self .assertIn (attr , cmd_output ['encryption' ])
119+ expected = {'provider' : 'LuksEncryptor' ,
120+ 'cipher' : 'aes-xts-plain64' ,
121+ 'key_size' : 128 ,
122+ 'control_location' : 'front-end' }
123+ for attr , value in expected .items ():
124+ self .assertEqual (value , cmd_output ['encryption' ][attr ])
127125 # test show encryption type
128126 cmd_output = json .loads (self .openstack (
129127 'volume type show -f json --encryption-type ' + encryption_type ))
130- # TODO(amotoki): encryption output should be machine-readable
131- expected = ["provider='LuksEncryptor'" ,
132- "cipher='aes-xts-plain64'" ,
133- "key_size='128'" ,
134- "control_location='front-end'" ]
135- for attr in expected :
136- self .assertIn (attr , cmd_output ['encryption' ])
128+ expected = {'provider' : 'LuksEncryptor' ,
129+ 'cipher' : 'aes-xts-plain64' ,
130+ 'key_size' : 128 ,
131+ 'control_location' : 'front-end' }
132+ for attr , value in expected .items ():
133+ self .assertEqual (value , cmd_output ['encryption' ][attr ])
137134 # test list encryption type
138135 cmd_output = json .loads (self .openstack (
139136 'volume type list -f json --encryption-type' ))
140137 encryption_output = [t ['Encryption' ] for t in cmd_output
141138 if t ['Name' ] == encryption_type ][0 ]
142- # TODO(amotoki): encryption output should be machine-readable
143- expected = ["provider='LuksEncryptor'" ,
144- "cipher='aes-xts-plain64'" ,
145- "key_size='128'" ,
146- "control_location='front-end'" ]
147- for attr in expected :
148- self .assertIn (attr , encryption_output )
139+ expected = {'provider' : 'LuksEncryptor' ,
140+ 'cipher' : 'aes-xts-plain64' ,
141+ 'key_size' : 128 ,
142+ 'control_location' : 'front-end' }
143+ for attr , value in expected .items ():
144+ self .assertEqual (value , encryption_output [attr ])
149145 # test set existing encryption type
150146 raw_output = self .openstack (
151147 'volume type set '
@@ -155,12 +151,12 @@ def test_encryption_type(self):
155151 self .assertEqual ('' , raw_output )
156152 cmd_output = json .loads (self .openstack (
157153 'volume type show -f json --encryption-type ' + encryption_type ))
158- expected = [ " provider=' LuksEncryptor'" ,
159- " cipher=' aes-xts-plain64'" ,
160- " key_size=' 256'" ,
161- " control_location=' back-end'" ]
162- for attr in expected :
163- self .assertIn ( attr , cmd_output ['encryption' ])
154+ expected = { ' provider' : ' LuksEncryptor' ,
155+ ' cipher' : ' aes-xts-plain64' ,
156+ ' key_size' : 256 ,
157+ ' control_location' : ' back-end'}
158+ for attr , value in expected . items () :
159+ self .assertEqual ( value , cmd_output ['encryption' ][ attr ])
164160 # test set new encryption type
165161 raw_output = self .openstack (
166162 'volume type set '
@@ -172,19 +168,19 @@ def test_encryption_type(self):
172168 self .assertEqual ('' , raw_output )
173169 cmd_output = json .loads (self .openstack (
174170 'volume type show -f json --encryption-type ' + self .NAME ))
175- expected = [ " provider=' LuksEncryptor'" ,
176- " cipher=' aes-xts-plain64'" ,
177- " key_size=' 128'" ,
178- " control_location=' front-end'" ]
179- for attr in expected :
180- self .assertIn ( attr , cmd_output ['encryption' ])
171+ expected = { ' provider' : ' LuksEncryptor' ,
172+ ' cipher' : ' aes-xts-plain64' ,
173+ ' key_size' : 128 ,
174+ ' control_location' : ' front-end'}
175+ for attr , value in expected . items () :
176+ self .assertEqual ( value , cmd_output ['encryption' ][ attr ])
181177 # test unset encryption type
182178 raw_output = self .openstack (
183179 'volume type unset --encryption-type ' + self .NAME )
184180 self .assertEqual ('' , raw_output )
185181 cmd_output = json .loads (self .openstack (
186182 'volume type show -f json --encryption-type ' + self .NAME ))
187- self .assertEqual ('' , cmd_output ['encryption' ])
183+ self .assertEqual ({} , cmd_output ['encryption' ])
188184 # test delete encryption type
189185 raw_output = self .openstack ('volume type delete ' + encryption_type )
190186 self .assertEqual ('' , raw_output )
0 commit comments