Skip to content

Commit

Permalink
pylint; remove test flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
mccoyp committed Jun 11, 2021
1 parent 0833559 commit 0ee385f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the MIT License.
# ------------------------------------
import base64
import six
from typing import TYPE_CHECKING

from azure.core.exceptions import HttpResponseError
Expand All @@ -14,6 +13,7 @@
OperationFailed,
OperationResourcePolling,
)
import six

from .helpers import _failed, _get_retry_after, _raise_if_bad_http_status_and_method

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,7 @@ def setUp(self, *args, **kwargs):
@property
def credential(self):
if self.is_live:
from dotenv import load_dotenv
from azure.identity import ClientSecretCredential
import os
load_dotenv()
return ClientSecretCredential(
tenant_id=os.environ["KEYVAULT_TENANT_ID"],
client_id=os.environ["KEYVAULT_CLIENT_ID"],
client_secret=os.environ["KEYVAULT_CLIENT_SECRET"]
)
return DefaultAzureCredential()
return mock.Mock(get_token=lambda *_, **__: AccessToken("secret", time.time() + 3600))

@ResourceGroupPreparer(random_name_enabled=True, use_cache=True)
Expand Down Expand Up @@ -85,10 +77,6 @@ def test_full_backup_and_restore_rehydration(self, container_uri, sas_token):
token = backup_poller._polling_method.get_continuation_token()
rehydrated = backup_client.begin_backup(container_uri, sas_token, continuation_token=token)

# check that pollers and polling methods behave as expected
assert rehydrated.status() == "InProgress"
assert not rehydrated.done() or rehydrated.polling_method().finished()

backup_operation = rehydrated.result()
assert rehydrated.status() == "Succeeded" and rehydrated.polling_method().status() == "Succeeded"
assert backup_operation.folder_url
Expand All @@ -101,10 +89,6 @@ def test_full_backup_and_restore_rehydration(self, container_uri, sas_token):
token = restore_poller._polling_method.get_continuation_token()
rehydrated = backup_client.begin_restore(backup_operation.folder_url, sas_token, continuation_token=token)

# check that pollers and polling methods behave as expected
assert rehydrated.status() == "InProgress"
assert not rehydrated.done() or rehydrated.polling_method().finished()

rehydrated.result()
assert rehydrated.status() == "Succeeded" and rehydrated.polling_method().status() == "Succeeded"
restore_poller.wait()
Expand Down

0 comments on commit 0ee385f

Please sign in to comment.