Skip to content

Commit

Permalink
Fix Azure credential test
Browse files Browse the repository at this point in the history
  • Loading branch information
JimMadge committed Nov 20, 2024
1 parent db7e59a commit 4c2ec31
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tests/external/api/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
)

from data_safe_haven.directories import config_dir
from data_safe_haven.exceptions import DataSafeHavenAzureError
from data_safe_haven.exceptions import DataSafeHavenAzureError, DataSafeHavenCachedCredentialError
from data_safe_haven.external.api.credentials import (
AzureSdkCredential,
DeferredCredential,
GraphApiCredential,
)


class TestDeferredCredential:
class TestAzureSdkCredential:
def test_confirm_credentials_interactive(
self,
mock_confirm_yes, # noqa: ARG002
Expand All @@ -37,8 +37,8 @@ def test_confirm_credentials_interactive_fail(
DeferredCredential.cache_ = set()
credential = AzureSdkCredential(skip_confirmation=False)
with pytest.raises(
DataSafeHavenAzureError,
match="Error getting account information from Azure CLI.",
DataSafeHavenCachedCredentialError,
match="Selected credentials are incorrect.",
):
credential.get_credential()

Expand Down Expand Up @@ -67,8 +67,6 @@ def test_decode_token_error(
):
credential.decode_token(credential.token)


class TestAzureSdkCredential:
def test_get_credential(self, mock_azureclicredential_get_token): # noqa: ARG002
credential = AzureSdkCredential(skip_confirmation=True)
assert isinstance(credential.get_credential(), AzureCliCredential)
Expand Down

0 comments on commit 4c2ec31

Please sign in to comment.