Skip to content

Conversation

HemangChothani
Copy link
Collaborator

Added Samples For

  • Change default storage class

  • Change file storage class

  • CORS configuration

  • List file archived generation

  • Delete file archived generation

  • Copy file archived generation

Copy link
Collaborator

@mf2199 mf2199 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd watch for excessive line lengths and make capitalization consistent.

Comment on lines 280 to 284
storage_delete_file_archived_generation.delete_file_archived_generation(test_blob.bucket.name, test_blob.name,
test_blob.generation)
out, _ = capsys.readouterr()
assert "blob " + test_blob.name + " was deleted" in out
assert test_blob.bucket.get_blob(test_blob.name, generation=test_blob.generation) is None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested format:

    storage_delete_file_archived_generation.delete_file_archived_generation(
        test_blob.bucket.name,
        test_blob.name,
        test_blob.generation
    )
    out, _ = capsys.readouterr()
    assert "blob " + test_blob.name + " was deleted" in out

    blob = test_blob.bucket.get_blob(
        test_blob.name,
        generation=test_blob.generation
    )
    assert blob is None



def test_change_file_storage_class(test_blob, capsys):
blob = storage_change_file_storage_class.change_file_storage_class(test_blob.bucket.name, test_blob.name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another one:

    blob = storage_change_file_storage_class.change_file_storage_class(
        test_blob.bucket.name,
        test_blob.name
    )

etc.

)

print(
"Generation {} of the Blob {} in bucket {} copied to blob {} in bucket {}.".format(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either capitalize all Blob or leave lowercase, but be consistent.


bucket = storage_client.get_bucket(bucket_name)
bucket.delete_blob(blob_name, generation=generation)
print("Generation {} of blob {} was deleted from ".format(generation, blob_name, bucket_name))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing last {} in the format syntax.

blobs = storage_client.list_blobs(bucket_name)

for blob in blobs:
print(blob.name + "," + str(blob.generation))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep using format for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants