21
21
import uuid
22
22
23
23
from oslo_serialization import jsonutils
24
+ from oslo_utils .secretutils import md5
24
25
from oslo_utils import units
25
26
import requests
26
27
import six
@@ -206,7 +207,8 @@ def test_image_import_using_glance_direct(self):
206
207
status = 'active' ,
207
208
max_sec = 10 ,
208
209
delay_sec = 0.2 )
209
- expect_c = six .text_type (hashlib .md5 (image_data ).hexdigest ())
210
+ expect_c = six .text_type (md5 (image_data ,
211
+ usedforsecurity = False ).hexdigest ())
210
212
expect_h = six .text_type (hashlib .sha512 (image_data ).hexdigest ())
211
213
func_utils .verify_image_hashes_and_status (self ,
212
214
image_id ,
@@ -349,7 +351,8 @@ def test_image_import_using_web_download(self):
349
351
delay_sec = 0.2 ,
350
352
start_delay_sec = 1 )
351
353
with requests .get (image_data_uri ) as r :
352
- expect_c = six .text_type (hashlib .md5 (r .content ).hexdigest ())
354
+ expect_c = six .text_type (md5 (r .content ,
355
+ usedforsecurity = False ).hexdigest ())
353
356
expect_h = six .text_type (hashlib .sha512 (r .content ).hexdigest ())
354
357
func_utils .verify_image_hashes_and_status (self ,
355
358
image_id ,
@@ -726,7 +729,8 @@ def test_image_lifecycle(self):
726
729
response = requests .put (path , headers = headers , data = image_data )
727
730
self .assertEqual (http .NO_CONTENT , response .status_code )
728
731
729
- expect_c = six .text_type (hashlib .md5 (image_data ).hexdigest ())
732
+ expect_c = six .text_type (md5 (image_data ,
733
+ usedforsecurity = False ).hexdigest ())
730
734
expect_h = six .text_type (hashlib .sha512 (image_data ).hexdigest ())
731
735
func_utils .verify_image_hashes_and_status (self , image_id , expect_c ,
732
736
expect_h , 'active' )
@@ -1165,7 +1169,8 @@ def test_hidden_images(self):
1165
1169
image_data = b'ZZZZZ'
1166
1170
response = requests .put (path , headers = headers , data = image_data )
1167
1171
self .assertEqual (http .NO_CONTENT , response .status_code )
1168
- expect_c = six .text_type (hashlib .md5 (image_data ).hexdigest ())
1172
+ expect_c = six .text_type (md5 (image_data ,
1173
+ usedforsecurity = False ).hexdigest ())
1169
1174
expect_h = six .text_type (hashlib .sha512 (image_data ).hexdigest ())
1170
1175
func_utils .verify_image_hashes_and_status (self ,
1171
1176
image_id ,
@@ -1178,7 +1183,8 @@ def test_hidden_images(self):
1178
1183
image_data = b'WWWWW'
1179
1184
response = requests .put (path , headers = headers , data = image_data )
1180
1185
self .assertEqual (http .NO_CONTENT , response .status_code )
1181
- expect_c = six .text_type (hashlib .md5 (image_data ).hexdigest ())
1186
+ expect_c = six .text_type (md5 (image_data ,
1187
+ usedforsecurity = False ).hexdigest ())
1182
1188
expect_h = six .text_type (hashlib .sha512 (image_data ).hexdigest ())
1183
1189
func_utils .verify_image_hashes_and_status (self ,
1184
1190
image2_id ,
@@ -4621,7 +4627,8 @@ def test_image_import_using_glance_direct(self):
4621
4627
status = 'active' ,
4622
4628
max_sec = 15 ,
4623
4629
delay_sec = 0.2 )
4624
- expect_c = six .text_type (hashlib .md5 (image_data ).hexdigest ())
4630
+ expect_c = six .text_type (md5 (image_data ,
4631
+ usedforsecurity = False ).hexdigest ())
4625
4632
expect_h = six .text_type (hashlib .sha512 (image_data ).hexdigest ())
4626
4633
func_utils .verify_image_hashes_and_status (self ,
4627
4634
image_id ,
@@ -4784,7 +4791,8 @@ def test_image_import_using_glance_direct_different_backend(self):
4784
4791
status = 'active' ,
4785
4792
max_sec = 15 ,
4786
4793
delay_sec = 0.2 )
4787
- expect_c = six .text_type (hashlib .md5 (image_data ).hexdigest ())
4794
+ expect_c = six .text_type (md5 (image_data ,
4795
+ usedforsecurity = False ).hexdigest ())
4788
4796
expect_h = six .text_type (hashlib .sha512 (image_data ).hexdigest ())
4789
4797
func_utils .verify_image_hashes_and_status (self ,
4790
4798
image_id ,
@@ -4948,7 +4956,8 @@ def test_image_import_using_web_download(self):
4948
4956
delay_sec = 0.2 ,
4949
4957
start_delay_sec = 1 )
4950
4958
with requests .get (image_data_uri ) as r :
4951
- expect_c = six .text_type (hashlib .md5 (r .content ).hexdigest ())
4959
+ expect_c = six .text_type (md5 (r .content ,
4960
+ usedforsecurity = False ).hexdigest ())
4952
4961
expect_h = six .text_type (hashlib .sha512 (r .content ).hexdigest ())
4953
4962
func_utils .verify_image_hashes_and_status (self ,
4954
4963
image_id ,
@@ -5111,7 +5120,8 @@ def test_image_import_using_web_download_different_backend(self):
5111
5120
delay_sec = 0.2 ,
5112
5121
start_delay_sec = 1 )
5113
5122
with requests .get (image_data_uri ) as r :
5114
- expect_c = six .text_type (hashlib .md5 (r .content ).hexdigest ())
5123
+ expect_c = six .text_type (md5 (r .content ,
5124
+ usedforsecurity = False ).hexdigest ())
5115
5125
expect_h = six .text_type (hashlib .sha512 (r .content ).hexdigest ())
5116
5126
func_utils .verify_image_hashes_and_status (self ,
5117
5127
image_id ,
@@ -5273,7 +5283,8 @@ def test_image_import_multi_stores(self):
5273
5283
delay_sec = 0.2 ,
5274
5284
start_delay_sec = 1 )
5275
5285
with requests .get (image_data_uri ) as r :
5276
- expect_c = six .text_type (hashlib .md5 (r .content ).hexdigest ())
5286
+ expect_c = six .text_type (md5 (r .content ,
5287
+ usedforsecurity = False ).hexdigest ())
5277
5288
expect_h = six .text_type (hashlib .sha512 (r .content ).hexdigest ())
5278
5289
func_utils .verify_image_hashes_and_status (self ,
5279
5290
image_id ,
@@ -5435,7 +5446,8 @@ def test_copy_image_lifecycle(self):
5435
5446
delay_sec = 0.2 ,
5436
5447
start_delay_sec = 1 )
5437
5448
with requests .get (image_data_uri ) as r :
5438
- expect_c = six .text_type (hashlib .md5 (r .content ).hexdigest ())
5449
+ expect_c = six .text_type (md5 (r .content ,
5450
+ usedforsecurity = False ).hexdigest ())
5439
5451
expect_h = six .text_type (hashlib .sha512 (r .content ).hexdigest ())
5440
5452
func_utils .verify_image_hashes_and_status (self ,
5441
5453
image_id ,
@@ -5630,7 +5642,8 @@ def test_copy_image_revert_lifecycle(self):
5630
5642
delay_sec = 0.2 ,
5631
5643
start_delay_sec = 1 )
5632
5644
with requests .get (image_data_uri ) as r :
5633
- expect_c = six .text_type (hashlib .md5 (r .content ).hexdigest ())
5645
+ expect_c = six .text_type (md5 (r .content ,
5646
+ usedforsecurity = False ).hexdigest ())
5634
5647
expect_h = six .text_type (hashlib .sha512 (r .content ).hexdigest ())
5635
5648
func_utils .verify_image_hashes_and_status (self ,
5636
5649
image_id ,
@@ -5888,7 +5901,8 @@ def test_image_import_multi_stores_specifying_all_stores(self):
5888
5901
delay_sec = 0.2 ,
5889
5902
start_delay_sec = 1 )
5890
5903
with requests .get (image_data_uri ) as r :
5891
- expect_c = six .text_type (hashlib .md5 (r .content ).hexdigest ())
5904
+ expect_c = six .text_type (md5 (r .content ,
5905
+ usedforsecurity = False ).hexdigest ())
5892
5906
expect_h = six .text_type (hashlib .sha512 (r .content ).hexdigest ())
5893
5907
func_utils .verify_image_hashes_and_status (self ,
5894
5908
image_id ,
@@ -6029,7 +6043,8 @@ def test_image_lifecycle(self):
6029
6043
response = requests .put (path , headers = headers , data = image_data )
6030
6044
self .assertEqual (http .NO_CONTENT , response .status_code )
6031
6045
6032
- expect_c = six .text_type (hashlib .md5 (image_data ).hexdigest ())
6046
+ expect_c = six .text_type (md5 (image_data ,
6047
+ usedforsecurity = False ).hexdigest ())
6033
6048
expect_h = six .text_type (hashlib .sha512 (image_data ).hexdigest ())
6034
6049
func_utils .verify_image_hashes_and_status (self ,
6035
6050
image_id ,
@@ -6202,7 +6217,8 @@ def test_image_lifecycle_different_backend(self):
6202
6217
response = requests .put (path , headers = headers , data = image_data )
6203
6218
self .assertEqual (http .NO_CONTENT , response .status_code )
6204
6219
6205
- expect_c = six .text_type (hashlib .md5 (image_data ).hexdigest ())
6220
+ expect_c = six .text_type (md5 (image_data ,
6221
+ usedforsecurity = False ).hexdigest ())
6206
6222
expect_h = six .text_type (hashlib .sha512 (image_data ).hexdigest ())
6207
6223
func_utils .verify_image_hashes_and_status (self ,
6208
6224
image_id ,
@@ -6738,7 +6754,8 @@ def _create_and_import_image_data(self):
6738
6754
delay_sec = 0.2 ,
6739
6755
start_delay_sec = 1 )
6740
6756
with requests .get (image_data_uri ) as r :
6741
- expect_c = six .text_type (hashlib .md5 (r .content ).hexdigest ())
6757
+ expect_c = six .text_type (md5 (r .content ,
6758
+ usedforsecurity = False ).hexdigest ())
6742
6759
expect_h = six .text_type (hashlib .sha512 (r .content ).hexdigest ())
6743
6760
func_utils .verify_image_hashes_and_status (self ,
6744
6761
image_id ,
0 commit comments