-
-
Notifications
You must be signed in to change notification settings - Fork 931
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always convert azureservicebus namespace to fully qualified (#1892)
* Always convert azureservicebus namespace to fully qualified * Fix tests * Format exception
- Loading branch information
Showing
2 changed files
with
13 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,8 +103,11 @@ def get_queue_runtime_properties(self, queue_name): | |
|
||
URL_NOCREDS = 'azureservicebus://' | ||
URL_CREDS_SAS = 'azureservicebus://policyname:ke/y@hostname' | ||
URL_CREDS_SAS_FQ = 'azureservicebus://policyname:ke/[email protected]' # noqa | ||
URL_CREDS_DA = 'azureservicebus://DefaultAzureCredential@hostname' | ||
URL_CREDS_DA_FQ = 'azureservicebus://[email protected]' # noqa | ||
URL_CREDS_MI = 'azureservicebus://ManagedIdentityCredential@hostname' | ||
URL_CREDS_MI_FQ = 'azureservicebus://[email protected]' # noqa | ||
|
||
|
||
def test_queue_service_nocredentials(): | ||
|
@@ -133,6 +136,7 @@ def test_queue_service_sas(): | |
# Ensure that queue_service is cached | ||
assert channel.queue_service == 'test' | ||
assert m.from_connection_string.call_count == 1 | ||
assert channel._namespace == 'hostname.servicebus.windows.net' | ||
|
||
|
||
def test_queue_service_da(): | ||
|
@@ -142,6 +146,7 @@ def test_queue_service_da(): | |
# Check the DefaultAzureCredential has been parsed from the url correctly | ||
# and the credential is a ManagedIdentityCredential | ||
assert isinstance(channel._credential, DefaultAzureCredential) | ||
assert channel._namespace == 'hostname.servicebus.windows.net' | ||
|
||
|
||
def test_queue_service_mi(): | ||
|
@@ -151,6 +156,7 @@ def test_queue_service_mi(): | |
# Check the ManagedIdentityCredential has been parsed from the url | ||
# correctly and the credential is a ManagedIdentityCredential | ||
assert isinstance(channel._credential, ManagedIdentityCredential) | ||
assert channel._namespace == 'hostname.servicebus.windows.net' | ||
|
||
|
||
def test_conninfo(): | ||
|
@@ -450,14 +456,14 @@ def test_basic_ack_reject_message_when_raises_exception( | |
|
||
def test_returning_sas(): | ||
conn = Connection(URL_CREDS_SAS, transport=azureservicebus.Transport) | ||
assert conn.as_uri(True) == URL_CREDS_SAS | ||
assert conn.as_uri(True) == URL_CREDS_SAS_FQ | ||
|
||
|
||
def test_returning_da(): | ||
conn = Connection(URL_CREDS_DA, transport=azureservicebus.Transport) | ||
assert conn.as_uri(True) == URL_CREDS_DA | ||
assert conn.as_uri(True) == URL_CREDS_DA_FQ | ||
|
||
|
||
def test_returning_mi(): | ||
conn = Connection(URL_CREDS_MI, transport=azureservicebus.Transport) | ||
assert conn.as_uri(True) == URL_CREDS_MI | ||
assert conn.as_uri(True) == URL_CREDS_MI_FQ |