Skip to content

Commit

Permalink
add snapshot to get_blob_properties() response
Browse files Browse the repository at this point in the history
  • Loading branch information
xiafu-msft committed Sep 1, 2020
1 parent efc0102 commit 6e64509
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ def get_blob_properties(self, **kwargs):
except StorageErrorException as error:
process_storage_error(error)
blob_props.name = self.blob_name
blob_props.snapshot = self.snapshot
blob_props.container = self.container_name
return blob_props # type: ignore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ async def get_blob_properties(self, **kwargs):
except StorageErrorException as error:
process_storage_error(error)
blob_props.name = self.blob_name
blob_props.snapshot = self.snapshot
blob_props.container = self.container_name
return blob_props # type: ignore

Expand Down
5 changes: 3 additions & 2 deletions sdk/storage/azure-storage-blob/tests/test_common_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,11 @@ def test_blob_snapshot_exists(self, resource_group, location, storage_account, s

# Act
blob = self.bsc.get_blob_client(self.container_name, blob_name, snapshot=snapshot)
exists = blob.get_blob_properties()
prop = blob.get_blob_properties()

# Assert
self.assertTrue(exists)
self.assertTrue(prop)
self.assertEqual(snapshot['snapshot'], prop.snapshot)


@GlobalStorageAccountPreparer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,11 @@ async def test_blob_snapshot_exists(self, resource_group, location, storage_acco

# Act
blob = self.bsc.get_blob_client(self.container_name, blob_name, snapshot=snapshot)
exists = await blob.get_blob_properties()
prop = await blob.get_blob_properties()

# Assert
self.assertTrue(exists)
self.assertTrue(prop)
self.assertEqual(snapshot['snapshot'], prop.snapshot)


@GlobalStorageAccountPreparer()
Expand Down

0 comments on commit 6e64509

Please sign in to comment.