Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Storage] added tests for get_account_information across container client and blob client #35067

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-blob/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/storage/azure-storage-blob",
"Tag": "python/storage/azure-storage-blob_2ebf88fe05"
"Tag": "python/storage/azure-storage-blob_72aa299e55"
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword
:param base_url: Service URL. Required. Default value is "".
:type base_url: str
:keyword version: Specifies the version of the operation to use for this request. Default value
is "2021-12-02". Note that overriding this default value may result in unsupported behavior.
is "2024-08-04". Note that overriding this default value may result in unsupported behavior.
:paramtype version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class AzureBlobStorageConfiguration: # pylint: disable=too-many-instance-attrib
desired operation. Required.
:type url: str
:keyword version: Specifies the version of the operation to use for this request. Default value
is "2021-12-02". Note that overriding this default value may result in unsupported behavior.
is "2024-08-04". Note that overriding this default value may result in unsupported behavior.
:paramtype version: str
"""

def __init__(self, url: str, **kwargs: Any) -> None:
version: Literal["2021-12-02"] = kwargs.pop("version", "2021-12-02")
version: Literal["2024-08-04"] = kwargs.pop("version", "2024-08-04")

if url is None:
raise ValueError("Parameter 'url' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword
:param base_url: Service URL. Required. Default value is "".
:type base_url: str
:keyword version: Specifies the version of the operation to use for this request. Default value
is "2021-12-02". Note that overriding this default value may result in unsupported behavior.
is "2024-08-04". Note that overriding this default value may result in unsupported behavior.
:paramtype version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class AzureBlobStorageConfiguration: # pylint: disable=too-many-instance-attrib
desired operation. Required.
:type url: str
:keyword version: Specifies the version of the operation to use for this request. Default value
is "2021-12-02". Note that overriding this default value may result in unsupported behavior.
is "2024-08-04". Note that overriding this default value may result in unsupported behavior.
:paramtype version: str
"""

def __init__(self, url: str, **kwargs: Any) -> None:
version: Literal["2021-12-02"] = kwargs.pop("version", "2021-12-02")
version: Literal["2024-08-04"] = kwargs.pop("version", "2024-08-04")

if url is None:
raise ValueError("Parameter 'url' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2602,9 +2602,20 @@ async def set_tier( # pylint: disable=inconsistent-return-statements
return cls(pipeline_response, None, response_headers) # type: ignore

@distributed_trace_async
async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
async def get_account_info( # pylint: disable=inconsistent-return-statements
self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any
) -> None:
"""Returns the sku name and account kind.

:param timeout: The timeout parameter is expressed in seconds. For more information, see
:code:`<a
href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
Timeouts for Blob Service Operations.</a>`. Default value is None.
:type timeout: int
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
limit that is recorded in the analytics logs when storage analytics logging is enabled. Default
value is None.
:type request_id_parameter: str
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Expand All @@ -2626,6 +2637,8 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco

_request = build_get_account_info_request(
url=self._config.url,
timeout=timeout,
request_id_parameter=request_id_parameter,
restype=restype,
comp=comp,
version=self._config.version,
Expand Down Expand Up @@ -2656,6 +2669,7 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco
response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
response_headers["x-ms-sku-name"] = self._deserialize("str", response.headers.get("x-ms-sku-name"))
response_headers["x-ms-account-kind"] = self._deserialize("str", response.headers.get("x-ms-account-kind"))
response_headers["x-ms-is-hns-enabled"] = self._deserialize("bool", response.headers.get("x-ms-is-hns-enabled"))

if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1732,9 +1732,20 @@ async def list_blob_hierarchy_segment(
return deserialized # type: ignore

@distributed_trace_async
async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
async def get_account_info( # pylint: disable=inconsistent-return-statements
self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any
) -> None:
"""Returns the sku name and account kind.

:param timeout: The timeout parameter is expressed in seconds. For more information, see
:code:`<a
href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
Timeouts for Blob Service Operations.</a>`. Default value is None.
:type timeout: int
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
limit that is recorded in the analytics logs when storage analytics logging is enabled. Default
value is None.
:type request_id_parameter: str
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Expand All @@ -1756,6 +1767,8 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco

_request = build_get_account_info_request(
url=self._config.url,
timeout=timeout,
request_id_parameter=request_id_parameter,
restype=restype,
comp=comp,
version=self._config.version,
Expand Down Expand Up @@ -1786,6 +1799,7 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco
response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
response_headers["x-ms-sku-name"] = self._deserialize("str", response.headers.get("x-ms-sku-name"))
response_headers["x-ms-account-kind"] = self._deserialize("str", response.headers.get("x-ms-account-kind"))
response_headers["x-ms-is-hns-enabled"] = self._deserialize("bool", response.headers.get("x-ms-is-hns-enabled"))

if cls:
return cls(pipeline_response, None, response_headers) # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,20 @@ async def get_user_delegation_key(
return deserialized # type: ignore

@distributed_trace_async
async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
async def get_account_info( # pylint: disable=inconsistent-return-statements
self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any
) -> None:
"""Returns the sku name and account kind.

:param timeout: The timeout parameter is expressed in seconds. For more information, see
:code:`<a
href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
Timeouts for Blob Service Operations.</a>`. Default value is None.
:type timeout: int
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
limit that is recorded in the analytics logs when storage analytics logging is enabled. Default
value is None.
:type request_id_parameter: str
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Expand All @@ -503,6 +514,8 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco

_request = build_get_account_info_request(
url=self._config.url,
timeout=timeout,
request_id_parameter=request_id_parameter,
restype=restype,
comp=comp,
version=self._config.version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def build_create_request(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

blob_type: Literal["AppendBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob"))
version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02"))
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down Expand Up @@ -175,7 +175,7 @@ def build_append_block_request(

comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02"))
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down Expand Up @@ -271,7 +271,7 @@ def build_append_block_from_url_request(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock"))
version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02"))
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down Expand Up @@ -369,7 +369,7 @@ def build_seal_request(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

comp: Literal["seal"] = kwargs.pop("comp", _params.pop("comp", "seal"))
version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02"))
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
accept = _headers.pop("Accept", "application/xml")

# Construct URL
Expand Down
Loading