def test_errors(self): with patch('corehq.blobs.management.commands.run_blob_import.get_blob_db') as mock_, \ NamedTemporaryFile() as tempfile: mock_.return_value = ErrorBlobDB() make_blob_export(tempfile.name) with self.assertRaisesRegex(Exception, 'boom'): import_blobs_from_tgz(tempfile.name)
def import_sleep(): with patch('corehq.blobs.management.commands.run_blob_import.get_blob_db') as mock_, \ NamedTemporaryFile() as tempfile: mock_.return_value = SleeperBlobDB() make_blob_export(tempfile.name) results = import_blobs_from_tgz(tempfile.name) assert len(results) == NUM_WORKERS