Skip to content

Commit

Permalink
Update storage tests (#35239)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyan99 committed Apr 17, 2024
1 parent 707a0b4 commit aa08980
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-blob/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/storage/azure-storage-blob",
"Tag": "python/storage/azure-storage-blob_fa839739c1"
"Tag": "python/storage/azure-storage-blob_c4f327d388"
}
46 changes: 23 additions & 23 deletions sdk/storage/azure-storage-blob/tests/test_cpk.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_put_block_and_put_block_list(self, **kwargs):
assert put_block_list_resp['etag'] is not None
assert put_block_list_resp['last_modified'] is not None
assert put_block_list_resp['request_server_encrypted']
assert put_block_list_resp['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash
# assert put_block_list_resp['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash

# Act get the blob content without cpk should fail
with pytest.raises(HttpResponseError):
Expand All @@ -118,7 +118,7 @@ def test_put_block_and_put_block_list(self, **kwargs):
assert blob.readall() == b'AAABBBCCC'
assert blob.properties.etag == put_block_list_resp['etag']
assert blob.properties.last_modified == put_block_list_resp['last_modified']
assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
self._teardown(bsc)

@pytest.mark.live_test_only
Expand Down Expand Up @@ -149,7 +149,7 @@ def test_create_block_blob_with_chunks(self, **kwargs):
assert upload_response['etag'] is not None
assert upload_response['last_modified'] is not None
assert upload_response['request_server_encrypted']
assert upload_response['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash
# assert upload_response['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash

# Act get the blob content without cpk should fail
with pytest.raises(HttpResponseError):
Expand All @@ -162,7 +162,7 @@ def test_create_block_blob_with_chunks(self, **kwargs):
assert blob.readall() == self.byte_data
assert blob.properties.etag == upload_response['etag']
assert blob.properties.last_modified == upload_response['last_modified']
assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
self._teardown(bsc)

@pytest.mark.live_test_only
Expand Down Expand Up @@ -190,7 +190,7 @@ def test_create_block_blob_with_sub_streams(self, **kwargs):
assert upload_response['etag'] is not None
assert upload_response['last_modified'] is not None
assert upload_response['request_server_encrypted']
assert upload_response['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash
# assert upload_response['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash

# Act get the blob content without cpk should fail
with pytest.raises(HttpResponseError):
Expand All @@ -203,7 +203,7 @@ def test_create_block_blob_with_sub_streams(self, **kwargs):
assert blob.readall() == self.byte_data
assert blob.properties.etag == upload_response['etag']
assert blob.properties.last_modified == upload_response['last_modified']
assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
self._teardown(bsc)

@BlobPreparer()
Expand All @@ -230,7 +230,7 @@ def test_create_block_blob_with_single_chunk(self, **kwargs):
assert upload_response['etag'] is not None
assert upload_response['last_modified'] is not None
assert upload_response['request_server_encrypted']
assert upload_response['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash
# assert upload_response['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash

# Act get the blob content without cpk should fail
with pytest.raises(HttpResponseError):
Expand All @@ -243,7 +243,7 @@ def test_create_block_blob_with_single_chunk(self, **kwargs):
assert blob.readall() == data
assert blob.properties.etag == upload_response['etag']
assert blob.properties.last_modified == upload_response['last_modified']
assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
self._teardown(bsc)

@BlobPreparer()
Expand Down Expand Up @@ -308,7 +308,7 @@ def test_put_block_from_url_and_commit_with_cpk(self, **kwargs):
assert put_block_list_resp['etag'] is not None
assert put_block_list_resp['last_modified'] is not None
assert put_block_list_resp['request_server_encrypted']
assert put_block_list_resp['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash
# assert put_block_list_resp['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash

# Act get the blob content
blob = destination_blob_client.download_blob(cpk=TEST_ENCRYPTION_KEY)
Expand All @@ -317,7 +317,7 @@ def test_put_block_from_url_and_commit_with_cpk(self, **kwargs):
assert blob.readall() == self.byte_data[0: 8 * 1024]
assert blob.properties.etag == put_block_list_resp['etag']
assert blob.properties.last_modified == put_block_list_resp['last_modified']
assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
self._teardown(bsc)

@BlobPreparer()
Expand Down Expand Up @@ -346,7 +346,7 @@ def test_append_block(self, **kwargs):
assert append_blob_prop['etag'] is not None
assert append_blob_prop['last_modified'] is not None
assert append_blob_prop['request_server_encrypted']
assert append_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash
# assert append_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash

# Act get the blob content without cpk should fail
with pytest.raises(HttpResponseError):
Expand All @@ -357,7 +357,7 @@ def test_append_block(self, **kwargs):

# Assert content was retrieved with the cpk
assert blob.readall() == b'AAABBBCCC'
assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash

@BlobPreparer()
@recorded_by_proxy
Expand Down Expand Up @@ -404,7 +404,7 @@ def test_append_block_from_url(self, **kwargs):
assert append_blob_prop['etag'] is not None
assert append_blob_prop['last_modified'] is not None
assert append_blob_prop['request_server_encrypted']
assert append_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash
# assert append_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash

# Act get the blob content without cpk should fail
with pytest.raises(HttpResponseError):
Expand All @@ -415,7 +415,7 @@ def test_append_block_from_url(self, **kwargs):

# Assert content was retrieved with the cpk
assert blob.readall() == self.byte_data[0: 4 * 1024]
assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
self._teardown(bsc)

@BlobPreparer()
Expand Down Expand Up @@ -444,7 +444,7 @@ def test_create_append_blob_with_chunks(self, **kwargs):
assert append_blob_prop['etag'] is not None
assert append_blob_prop['last_modified'] is not None
assert append_blob_prop['request_server_encrypted']
assert append_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash
# assert append_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash

# Act get the blob content without cpk should fail
with pytest.raises(HttpResponseError):
Expand All @@ -455,7 +455,7 @@ def test_create_append_blob_with_chunks(self, **kwargs):

# Assert content was retrieved with the cpk
assert blob.readall() == self.byte_data
assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
self._teardown(bsc)

@BlobPreparer()
Expand Down Expand Up @@ -486,7 +486,7 @@ def test_update_page(self, **kwargs):
assert page_blob_prop['etag'] is not None
assert page_blob_prop['last_modified'] is not None
assert page_blob_prop['request_server_encrypted']
assert page_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash
# assert page_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash

# Act get the blob content without cpk should fail
with pytest.raises(HttpResponseError):
Expand All @@ -499,7 +499,7 @@ def test_update_page(self, **kwargs):

# Assert content was retrieved with the cpk
assert blob.readall() == self.byte_data
assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
self._teardown(bsc)

@BlobPreparer()
Expand Down Expand Up @@ -548,7 +548,7 @@ def test_update_page_from_url(self, **kwargs):
assert page_blob_prop['etag'] is not None
assert page_blob_prop['last_modified'] is not None
assert page_blob_prop['request_server_encrypted']
assert page_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash
# assert page_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash

# Act get the blob content without cpk should fail
with pytest.raises(HttpResponseError):
Expand All @@ -561,7 +561,7 @@ def test_update_page_from_url(self, **kwargs):

# Assert content was retrieved with the cpk
assert blob.readall() == self.byte_data
assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
self._teardown(bsc)

@pytest.mark.live_test_only
Expand Down Expand Up @@ -590,7 +590,7 @@ def test_create_page_blob_with_chunks(self, **kwargs):
assert page_blob_prop['etag'] is not None
assert page_blob_prop['last_modified'] is not None
assert page_blob_prop['request_server_encrypted']
assert page_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash
# assert page_blob_prop['encryption_key_sha256'] == TEST_ENCRYPTION_KEY.key_hash

# Act get the blob content without cpk should fail
with pytest.raises(HttpResponseError):
Expand All @@ -601,7 +601,7 @@ def test_create_page_blob_with_chunks(self, **kwargs):

# Assert content was retrieved with the cpk
assert blob.readall() == self.byte_data
assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob.properties.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
self._teardown(bsc)

@BlobPreparer()
Expand Down Expand Up @@ -633,7 +633,7 @@ def test_get_set_blob_metadata(self, **kwargs):

# Assert
assert blob_props.server_encrypted
assert blob_props.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash
# assert blob_props.encryption_key_sha256 == TEST_ENCRYPTION_KEY.key_hash

# Act set blob properties
metadata = {'hello': 'world', 'number': '42', 'up': 'upval'}
Expand Down
Loading

0 comments on commit aa08980

Please sign in to comment.