diff --git a/rohmu/object_storage/azure.py b/rohmu/object_storage/azure.py index f025f22b..22635eba 100644 --- a/rohmu/object_storage/azure.py +++ b/rohmu/object_storage/azure.py @@ -123,20 +123,24 @@ def conn_string( is_secure: bool, ) -> str: protocol = "https" if is_secure else "http" - conn_str = f"DefaultEndpointsProtocol={protocol};" f"AccountName={account_name};" f"AccountKey={account_key};" + conn = [ + f"DefaultEndpointsProtocol={protocol}", + f"AccountName={account_name}", + f"AccountKey={account_key}", + ] if not host and not port: try: endpoint_suffix = ENDPOINT_SUFFIXES[azure_cloud] except KeyError: raise InvalidConfigurationError(f"Unknown azure cloud {repr(azure_cloud)}") - conn_str = f"{conn_str}" f"EndpointSuffix={endpoint_suffix};" + conn.append(f"EndpointSuffix={endpoint_suffix}") else: if not host or not port: raise InvalidConfigurationError("Custom host and port must be specified together") - conn_str = f"{conn_str}" f"BlobEndpoint={protocol}://{host}:{port}/{account_name};" - return conn_str + conn.append(f"BlobEndpoint={protocol}://{host}:{port}/{account_name}") + return ";".join(conn) def copy_file( self, *, source_key: str, destination_key: str, metadata: Optional[Metadata] = None, **kwargs: Any diff --git a/test/object_storage/test_azure.py b/test/object_storage/test_azure.py index 73edd92e..66de2c09 100644 --- a/test/object_storage/test_azure.py +++ b/test/object_storage/test_azure.py @@ -112,12 +112,12 @@ def test_get_contents_to_fileobj_raises_error_on_invalid_byte_range(azure_module None, None, True, - "".join( + ";".join( [ - "DefaultEndpointsProtocol=https;", - "AccountName=test_name;", - "AccountKey=test_key;", - "EndpointSuffix=core.windows.net;", + "DefaultEndpointsProtocol=https", + "AccountName=test_name", + "AccountKey=test_key", + "EndpointSuffix=core.windows.net", ] ), ), @@ -125,12 +125,12 @@ def test_get_contents_to_fileobj_raises_error_on_invalid_byte_range(azure_module None, None, False, - "".join( + ";".join( [ - "DefaultEndpointsProtocol=http;", - "AccountName=test_name;", - "AccountKey=test_key;", - "EndpointSuffix=core.windows.net;", + "DefaultEndpointsProtocol=http", + "AccountName=test_name", + "AccountKey=test_key", + "EndpointSuffix=core.windows.net", ] ), ), @@ -138,12 +138,12 @@ def test_get_contents_to_fileobj_raises_error_on_invalid_byte_range(azure_module "localhost", 10000, True, - "".join( + ";".join( [ - "DefaultEndpointsProtocol=https;", - "AccountName=test_name;", - "AccountKey=test_key;", - "BlobEndpoint=https://localhost:10000/test_name;", + "DefaultEndpointsProtocol=https", + "AccountName=test_name", + "AccountKey=test_key", + "BlobEndpoint=https://localhost:10000/test_name", ] ), ), @@ -151,12 +151,12 @@ def test_get_contents_to_fileobj_raises_error_on_invalid_byte_range(azure_module "localhost", 10000, False, - "".join( + ";".join( [ - "DefaultEndpointsProtocol=http;", - "AccountName=test_name;", - "AccountKey=test_key;", - "BlobEndpoint=http://localhost:10000/test_name;", + "DefaultEndpointsProtocol=http", + "AccountName=test_name", + "AccountKey=test_key", + "BlobEndpoint=http://localhost:10000/test_name", ] ), ),