@pytest.mark.live_test_only
@GlobalStorageAccountPreparer()
@AsyncStorageTestCase.await_prepared_test
async def test_shared_write_access_blob(self, resource_group, location, storage_account, storage_account_key):
    (await self._setup(storage_account.name, storage_account_key))
    updated_data = b'updated blob data'
    blob_name = (await self._create_block_blob())
    blob = self.bsc.get_blob_client(self.container_name, blob_name)
    token = generate_blob_sas(blob.account_name, blob.container_name, blob.blob_name, snapshot=blob.snapshot, account_key=blob.credential.account_key, permission=BlobSasPermissions(write=True), expiry=(datetime.utcnow() + timedelta(hours=1)))
    sas_blob = BlobClient.from_blob_url(blob.url, credential=token)
    headers = {'x-ms-blob-type': 'BlockBlob'}
    response = requests.put(sas_blob.url, headers=headers, data=updated_data)
    response.raise_for_status()
    self.assertTrue(response.ok)
    data = (await (await blob.download_blob()).readall())
    self.assertEqual(updated_data, data)
@pytest.mark.live_test_only
@GlobalStorageAccountPreparer()
@AsyncStorageTestCase.await_prepared_test
async def test_shared_write_access_blob(self, resource_group, location, storage_account, storage_account_key):
    (await self._setup(storage_account.name, storage_account_key))
    updated_data = b'updated blob data'
    blob_name = (await self._create_block_blob())
    blob = self.bsc.get_blob_client(self.container_name, blob_name)
    token = generate_blob_sas(blob.account_name, blob.container_name, blob.blob_name, snapshot=blob.snapshot, account_key=blob.credential.account_key, permission=BlobSasPermissions(write=True), expiry=(datetime.utcnow() + timedelta(hours=1)))
    sas_blob = BlobClient.from_blob_url(blob.url, credential=token)
    headers = {'x-ms-blob-type': 'BlockBlob'}
    response = requests.put(sas_blob.url, headers=headers, data=updated_data)
    response.raise_for_status()
    self.assertTrue(response.ok)
    data = (await (await blob.download_blob()).readall())
    self.assertEqual(updated_data, data)