Skip to content

Commit

Permalink
Lint gcs
Browse files Browse the repository at this point in the history
  • Loading branch information
berroar committed Feb 9, 2024
1 parent 8b3fe07 commit 9617776
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/test_google_cloud_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,32 @@ def patch_gcs_client(mocker):
def test_upload_files(patch_gcs_client):
gcs_storage = GoogleCloudStorage(bucket_name="benchmark_bucket")

gcs_storage.upload_files(output_files=["mock_output_stats.csv"], directory="benchmark_outputs")
gcs_storage.upload_files(
output_files=["mock_output_stats.csv"], directory="benchmark_outputs"
)

bucket = patch_gcs_client.return_value.get_bucket.return_value
blob = bucket.blob.return_value

assert blob.upload_from_filename.call_count == 1
assert blob.upload_from_filename.call_args[1] == {"filename": "mock_output_stats.csv"}
assert blob.upload_from_filename.call_args[1] == {
"filename": "mock_output_stats.csv"
}


def test_upload_files_with_prefix(patch_gcs_client):
gcs_storage = GoogleCloudStorage(bucket_name="benchmark_bucket")

gcs_storage.upload_files(output_files=["mock_output_stats.csv"], directory="benchmark_outputs", output_filename_prefix="test")
gcs_storage.upload_files(
output_files=["mock_output_stats.csv"],
directory="benchmark_outputs",
output_filename_prefix="test",
)

bucket = patch_gcs_client.return_value.get_bucket.return_value
blob = bucket.blob.return_value

assert blob.upload_from_filename.call_count == 1
assert blob.upload_from_filename.call_args[1] == {"filename": "mock_output_stats.csv"}
assert blob.upload_from_filename.call_args[1] == {
"filename": "mock_output_stats.csv"
}

0 comments on commit 9617776

Please sign in to comment.