@@ -96,14 +96,15 @@ def test_mirroring(self):
96
96
with self .subTest ('mirror_partition' ):
97
97
file , file_message = self ._test_mirror_partition (partition_message )
98
98
99
- with self .subTest ('mirror_file' , corrupted = False ):
99
+ with self .subTest ('mirror_file' , corrupted = False , exists = False ):
100
100
self ._test_mirror_file (file , file_message )
101
101
102
102
# Force reupload attempts even if the info object is present
103
103
with patch .object (MirrorService , 'is_mirrored' , return_value = False ):
104
104
with self .subTest ('mirror_file' , corrupted = True ):
105
105
self ._test_corrupted_download (file_message )
106
-
106
+ with self .subTest ('mirror_file' , corrupted = False , exists = True ):
107
+ self ._test_reuploaded_file (file_message )
107
108
108
109
_file_contents = b'lorem ipsum dolor sit\n '
109
110
@@ -172,6 +173,14 @@ def _test_corrupted_download(self, file_message):
172
173
self .mirror_controller .mirror (event )
173
174
self .assertTrue (R .caused (e .exception ))
174
175
176
+ def _test_reuploaded_file (self , file_message ):
177
+ event = [self ._mock_sqs_record (file_message )]
178
+ with patch .object (MirrorService , '_download' , return_value = self ._file_contents ):
179
+ with self .assertRaises (AssertionError ) as e :
180
+ self .mirror_controller .mirror (event )
181
+ self .assertTrue (R .caused (e .exception ))
182
+ self .assertEqual (e .exception .args [0 ].args [0 ], 'Object exists' )
183
+
175
184
def test_info_schema (self ):
176
185
client = http_client (log )
177
186
file = MagicMock (content_type = 'text/plain' )
0 commit comments