@pytest.mark.live_test_only
@GlobalStorageAccountPreparer()
@AsyncStorageTestCase.await_prepared_test
async def test_token_credential(self, resource_group, location, storage_account, storage_account_key):
    (await self._setup(storage_account.name, storage_account_key))
    token_credential = self.generate_oauth_token()
    service = BlobServiceClient(self.account_url(storage_account.name, 'blob'), credential=token_credential, transport=AiohttpTestTransport())
    result = (await service.get_service_properties())
    self.assertIsNotNone(result)
    fake_credential = self.generate_fake_token()
    service = BlobServiceClient(self.account_url(storage_account.name, 'blob'), credential=fake_credential, transport=AiohttpTestTransport())
    with self.assertRaises(ClientAuthenticationError):
        (await service.get_service_properties())
    service = BlobServiceClient(self.account_url(storage_account.name, 'blob'), credential=token_credential, transport=AiohttpTestTransport())
    result = (await service.get_service_properties())
    self.assertIsNotNone(result)
@pytest.mark.live_test_only
@GlobalStorageAccountPreparer()
@AsyncStorageTestCase.await_prepared_test
async def test_token_credential(self, resource_group, location, storage_account, storage_account_key):
    (await self._setup(storage_account.name, storage_account_key))
    token_credential = self.generate_oauth_token()
    service = BlobServiceClient(self.account_url(storage_account.name, 'blob'), credential=token_credential, transport=AiohttpTestTransport())
    result = (await service.get_service_properties())
    self.assertIsNotNone(result)
    fake_credential = self.generate_fake_token()
    service = BlobServiceClient(self.account_url(storage_account.name, 'blob'), credential=fake_credential, transport=AiohttpTestTransport())
    with self.assertRaises(ClientAuthenticationError):
        (await service.get_service_properties())
    service = BlobServiceClient(self.account_url(storage_account.name, 'blob'), credential=token_credential, transport=AiohttpTestTransport())
    result = (await service.get_service_properties())
    self.assertIsNotNone(result)