Skip to content

Commit 2a92cc9

Browse files
test: enhance queue client creation test with URL validation
1 parent b9f1d06 commit 2a92cc9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

code/tests/utilities/helpers/test_azure_blob_storage_client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def test_create_queue_client_with_key_auth(self, mock_queue_client_class, mock_e
7979
@patch("backend.batch.utilities.helpers.azure_blob_storage_client.QueueClient")
8080
def test_create_queue_client_with_rbac(self, mock_queue_client_class, mock_get_credential, mock_env_helper_rbac):
8181
"""Test queue client creation with RBAC authentication."""
82+
from urllib.parse import urlparse
83+
8284
mock_credential = Mock()
8385
mock_get_credential.return_value = mock_credential
8486

@@ -89,7 +91,10 @@ def test_create_queue_client_with_rbac(self, mock_queue_client_class, mock_get_c
8991
call_kwargs = mock_queue_client_class.call_args[1]
9092
assert call_kwargs['queue_name'] == "test-queue"
9193
assert call_kwargs['credential'] == mock_credential
92-
assert "teststorageaccount.queue.core.windows.net" in call_kwargs['account_url']
94+
95+
# Properly validate URL by parsing and checking the netloc
96+
parsed_url = urlparse(call_kwargs['account_url'])
97+
assert parsed_url.netloc == "teststorageaccount.queue.core.windows.net"
9398

9499

95100
class TestAzureBlobStorageClientInitialization:

0 commit comments

Comments
 (0)