Skip to content

Commit 6cc5c53

Browse files
committed
Test for 'port' and 'hostname' attributes as well
1 parent 6bcb2b5 commit 6cc5c53

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/instrument_server/test_api.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ def test_get_murfey_url(
4040
with patch("murfey.instrument_server.api.config", mock_client_configuration):
4141
known_server = _get_murfey_url()
4242

43-
# Check that the components of the result match those in the config
44-
parsed_server = urlparse(known_server)
43+
# Prepend 'http://' to config URLs that don't have it for the comparison
44+
# Otherwise, urlparse stores it under the 'path' attribute
4545
original_url = str(mock_client_configuration["Murfey"].get("server"))
4646
if not original_url.startswith(("http://", "https://")):
4747
original_url = f"http://{original_url}"
4848
parsed_original = urlparse(original_url)
49+
parsed_server = urlparse(known_server)
50+
# Check that the components of the result match those in the config
4951
assert parsed_server.scheme in ("http", "https")
52+
assert parsed_server.hostname == parsed_original.hostname
53+
assert parsed_server.port == parsed_original.port
5054
assert parsed_server.netloc == parsed_original.netloc
5155
assert parsed_server.path == parsed_original.path
5256

0 commit comments

Comments
 (0)