@@ -605,9 +605,11 @@ def test_encrypt_locations_on_add(self):
605
605
self .image_repo .add (image )
606
606
db_data = self .db .image_get (self .context , UUID1 )
607
607
self .assertNotEqual (db_data ['locations' ], ['foo' , 'bar' ])
608
- decrypted_locations = [crypt .urlsafe_decrypt (self .crypt_key , l ['url' ])
609
- for l in db_data ['locations' ]]
610
- self .assertEqual ([l ['url' ] for l in self .foo_bar_location ],
608
+ decrypted_locations = [crypt .urlsafe_decrypt (self .crypt_key ,
609
+ location ['url' ])
610
+ for location in db_data ['locations' ]]
611
+ self .assertEqual ([location ['url' ]
612
+ for location in self .foo_bar_location ],
611
613
decrypted_locations )
612
614
613
615
def test_encrypt_locations_on_save (self ):
@@ -617,19 +619,23 @@ def test_encrypt_locations_on_save(self):
617
619
self .image_repo .save (image )
618
620
db_data = self .db .image_get (self .context , UUID1 )
619
621
self .assertNotEqual (db_data ['locations' ], ['foo' , 'bar' ])
620
- decrypted_locations = [crypt .urlsafe_decrypt (self .crypt_key , l ['url' ])
621
- for l in db_data ['locations' ]]
622
- self .assertEqual ([l ['url' ] for l in self .foo_bar_location ],
622
+ decrypted_locations = [crypt .urlsafe_decrypt (self .crypt_key ,
623
+ location ['url' ])
624
+ for location in db_data ['locations' ]]
625
+ self .assertEqual ([location ['url' ]
626
+ for location in self .foo_bar_location ],
623
627
decrypted_locations )
624
628
625
629
def test_decrypt_locations_on_get (self ):
626
630
url_loc = ['ping' , 'pong' ]
627
- orig_locations = [{'url' : l , 'metadata' : {}, 'status' : 'active' }
628
- for l in url_loc ]
629
- encrypted_locs = [crypt .urlsafe_encrypt (self .crypt_key , l )
630
- for l in url_loc ]
631
- encrypted_locations = [{'url' : l , 'metadata' : {}, 'status' : 'active' }
632
- for l in encrypted_locs ]
631
+ orig_locations = [{'url' : location , 'metadata' : {}, 'status' : 'active' }
632
+ for location in url_loc ]
633
+ encrypted_locs = [crypt .urlsafe_encrypt (self .crypt_key , location )
634
+ for location in url_loc ]
635
+ encrypted_locations = [{'url' : location ,
636
+ 'metadata' : {},
637
+ 'status' : 'active' }
638
+ for location in encrypted_locs ]
633
639
self .assertNotEqual (encrypted_locations , orig_locations )
634
640
db_data = _db_fixture (UUID1 , owner = TENANT1 ,
635
641
locations = encrypted_locations )
@@ -643,12 +649,14 @@ def test_decrypt_locations_on_get(self):
643
649
644
650
def test_decrypt_locations_on_list (self ):
645
651
url_loc = ['ping' , 'pong' ]
646
- orig_locations = [{'url' : l , 'metadata' : {}, 'status' : 'active' }
647
- for l in url_loc ]
648
- encrypted_locs = [crypt .urlsafe_encrypt (self .crypt_key , l )
649
- for l in url_loc ]
650
- encrypted_locations = [{'url' : l , 'metadata' : {}, 'status' : 'active' }
651
- for l in encrypted_locs ]
652
+ orig_locations = [{'url' : location , 'metadata' : {}, 'status' : 'active' }
653
+ for location in url_loc ]
654
+ encrypted_locs = [crypt .urlsafe_encrypt (self .crypt_key , location )
655
+ for location in url_loc ]
656
+ encrypted_locations = [{'url' : location ,
657
+ 'metadata' : {},
658
+ 'status' : 'active' }
659
+ for location in encrypted_locs ]
652
660
self .assertNotEqual (encrypted_locations , orig_locations )
653
661
db_data = _db_fixture (UUID1 , owner = TENANT1 ,
654
662
locations = encrypted_locations )
0 commit comments