Skip to content
Permalink
Browse files
fix: update 'custom_time' setter to record change (#323)
Closes #322.
  • Loading branch information
haim0n committed Nov 24, 2020
1 parent 547740c commit 5174154fe73bb6581efc3cd32ebe12014ceab306
Showing with 5 additions and 1 deletion.
  1. +1 −1 google/cloud/storage/blob.py
  2. +4 −0 tests/unit/test_blob.py
@@ -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):
@@ -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
@@ -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"
@@ -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()
@@ -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

0 comments on commit 5174154

Please sign in to comment.