Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add change in 'Blob.custom_time' to changes #323

Merged
merged 1 commit into from Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion google/cloud/storage/blob.py
Expand Up @@ -3613,7 +3613,7 @@ def custom_time(self, value):
if value is not None:
value = _datetime_to_rfc3339(value)

self._properties["customTime"] = value
self._patch_property("customTime", value)


def _get_encryption_headers(key, source=False):
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_blob.py
Expand Up @@ -3987,6 +3987,7 @@ def test_update_storage_class_w_generation_match(self):
if_generation_match=GENERATION_NUMBER,
if_source_generation_match=SOURCE_GENERATION_NUMBER,
)

self.assertEqual(blob.storage_class, "NEARLINE")

kw = connection._requested
Expand Down Expand Up @@ -4236,6 +4237,7 @@ def test_metadata_setter(self):
self.assertIsNone(blob.metadata)
blob.metadata = METADATA
self.assertEqual(blob.metadata, METADATA)
self.assertIn("metadata", blob._changes)

def test_metadata_setter_w_nan(self):
BLOB_NAME = "blob-name"
Expand All @@ -4246,6 +4248,7 @@ def test_metadata_setter_w_nan(self):
blob.metadata = METADATA
value = blob.metadata["foo"]
self.assertIsInstance(value, str)
self.assertIn("metadata", blob._changes)

def test_metageneration(self):
BUCKET = object()
Expand Down Expand Up @@ -4444,6 +4447,7 @@ def test_custom_time_setter(self):
self.assertIsNone(blob.custom_time)
blob.custom_time = TIMESTAMP
self.assertEqual(blob.custom_time, TIMESTAMP)
self.assertIn("customTime", blob._changes)

def test_custom_time_setter_none_value(self):
from google.cloud._helpers import _RFC3339_MICROS
Expand Down