def test_upload_area_delete_over_timeout(self, mock_retrieve_lambda_timeout): area_uuid = self._create_area() obj = self.upload_bucket.Object(f'{area_uuid}/test_file') obj.put(Body="foo") mock_retrieve_lambda_timeout.return_value = 0 area = UploadArea(area_uuid) area.delete() record = UploadDB().get_pg_record("upload_area", area_uuid, column='uuid') self.assertEqual("DELETION_QUEUED", record["status"])
def test_delete__marks_area_delete_and_deletes_objects(self): db_area = self.create_upload_area(db_session=self.db) obj = self.upload_bucket.Object(f'{db_area.uuid}/test_file') obj.put(Body="foo") with patch( 'upload.common.upload_area.UploadArea._retrieve_upload_area_deletion_lambda_timeout' ) as mock_retr: mock_retr.return_value = 900 area = UploadArea(uuid=db_area.uuid) area.delete() self.db.refresh(db_area) self.assertEqual("DELETED", db_area.status) with self.assertRaises(ClientError): obj.load()