diff --git a/sdk/storage/azure-storage-queue/tests/conftest.py b/sdk/storage/azure-storage-queue/tests/conftest.py
index 06999e12155c..e586a8fd5e78 100644
--- a/sdk/storage/azure-storage-queue/tests/conftest.py
+++ b/sdk/storage/azure-storage-queue/tests/conftest.py
@@ -1,32 +1,33 @@
-# --------------------------------------------------------------------------
-#
+# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
-#
-# The MIT License (MIT)
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the ""Software""), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
# --------------------------------------------------------------------------
-import sys
-# fixture needs to be visible from conftest
-# Ignore async tests for Python < 3.5
-collect_ignore_glob = []
-if sys.version_info < (3, 5):
- collect_ignore_glob.append("*_async.py")
+import os
+import platform
+
+import pytest
+
+from devtools_testutils import (
+ add_general_regex_sanitizer,
+ add_header_regex_sanitizer,
+ add_oauth_response_sanitizer,
+ add_uri_string_sanitizer,
+ test_proxy
+)
+
+@pytest.fixture(scope="session", autouse=True)
+def add_sanitizers(test_proxy):
+ subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
+ tenant_id = os.environ.get("STORAGE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000")
+ add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
+ add_header_regex_sanitizer(key="Cookie", value="cookie;")
+ add_oauth_response_sanitizer()
+
+ add_header_regex_sanitizer(key="x-ms-copy-source-authorization", value="Sanitized")
+ add_header_regex_sanitizer(key="x-ms-encryption-key", value="Sanitized")
+
+ add_uri_string_sanitizer(target=".preprod.", value=".")
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_request_callback_signed_header.json b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_request_callback_signed_header.json
new file mode 100644
index 000000000000..c2073ca2a7b4
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_request_callback_signed_header.json
@@ -0,0 +1,83 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/cont4acf311e",
+ "RequestMethod": "PUT",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "Connection": "keep-alive",
+ "Content-Length": "0",
+ "User-Agent": "azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:32:00 GMT",
+ "x-ms-meta-hello": "world",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 201,
+ "ResponseHeaders": {
+ "Content-Length": "0",
+ "Date": "Tue, 25 Oct 2022 21:31:59 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": null
+ },
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/cont4acf311e?comp=metadata",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "Connection": "keep-alive",
+ "User-Agent": "azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:32:01 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Length": "0",
+ "Date": "Tue, 25 Oct 2022 21:31:59 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-approximate-messages-count": "0",
+ "x-ms-meta-hello": "world",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": null
+ },
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/cont4acf311e",
+ "RequestMethod": "DELETE",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "Connection": "keep-alive",
+ "Content-Length": "0",
+ "User-Agent": "azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:32:01 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 204,
+ "ResponseHeaders": {
+ "Content-Length": "0",
+ "Date": "Tue, 25 Oct 2022 21:32:00 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": null
+ }
+ ],
+ "Variables": {}
+}
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_response_callback.json b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_response_callback.json
new file mode 100644
index 000000000000..5f5273bea320
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_response_callback.json
@@ -0,0 +1,35 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/conte1852be3?comp=metadata",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "Connection": "keep-alive",
+ "User-Agent": "azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:32:01 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 404,
+ "ResponseHeaders": {
+ "Content-Length": "217",
+ "Content-Type": "application/xml",
+ "Date": "Tue, 25 Oct 2022 21:32:00 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-error-code": "QueueNotFound",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": [
+ "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CError\u003E\u003CCode\u003EQueueNotFound\u003C/Code\u003E\u003CMessage\u003EThe specified queue does not exist.\n",
+ "RequestId:beead3c9-a003-007d-1fb9-e88702000000\n",
+ "Time:2022-10-25T21:32:01.2354880Z\u003C/Message\u003E\u003C/Error\u003E"
+ ]
+ }
+ ],
+ "Variables": {}
+}
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_user_agent_append.json b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_user_agent_append.json
new file mode 100644
index 000000000000..78c56ac304ae
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_user_agent_append.json
@@ -0,0 +1,31 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/?restype=service\u0026comp=properties",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "Connection": "keep-alive",
+ "User-Agent": "customer_user_agent azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:32:02 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Type": "application/xml",
+ "Date": "Tue, 25 Oct 2022 21:32:01 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "Transfer-Encoding": "chunked",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Efalse\u003C/Read\u003E\u003CWrite\u003Efalse\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E7\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003C/StorageServiceProperties\u003E"
+ }
+ ],
+ "Variables": {}
+}
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_user_agent_custom.json b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_user_agent_custom.json
new file mode 100644
index 000000000000..e0a490ba96fc
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_user_agent_custom.json
@@ -0,0 +1,57 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/?restype=service\u0026comp=properties",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "Connection": "keep-alive",
+ "User-Agent": "TestApp/v1.0 azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:32:02 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Type": "application/xml",
+ "Date": "Tue, 25 Oct 2022 21:32:01 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "Transfer-Encoding": "chunked",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Efalse\u003C/Read\u003E\u003CWrite\u003Efalse\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E7\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003C/StorageServiceProperties\u003E"
+ },
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/?restype=service\u0026comp=properties",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "Connection": "keep-alive",
+ "User-Agent": "TestApp/v2.0 TestApp/v1.0 azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:32:02 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Type": "application/xml",
+ "Date": "Tue, 25 Oct 2022 21:32:01 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "Transfer-Encoding": "chunked",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Efalse\u003C/Read\u003E\u003CWrite\u003Efalse\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E7\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003C/StorageServiceProperties\u003E"
+ }
+ ],
+ "Variables": {}
+}
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_user_agent_default.json b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_user_agent_default.json
new file mode 100644
index 000000000000..187f88149883
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.pyTestStorageQueueClienttest_user_agent_default.json
@@ -0,0 +1,31 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/?restype=service\u0026comp=properties",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "Connection": "keep-alive",
+ "User-Agent": "azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:32:01 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Type": "application/xml",
+ "Date": "Tue, 25 Oct 2022 21:32:00 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "Transfer-Encoding": "chunked",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Efalse\u003C/Read\u003E\u003CWrite\u003Efalse\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E7\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003C/StorageServiceProperties\u003E"
+ }
+ ],
+ "Variables": {}
+}
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_request_callback_signed_header.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_request_callback_signed_header.yaml
deleted file mode 100644
index 30eda78848d8..000000000000
--- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_request_callback_signed_header.yaml
+++ /dev/null
@@ -1,110 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- Content-Length:
- - '0'
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:41 GMT
- x-ms-meta-hello:
- - world
- x-ms-version:
- - '2018-03-28'
- method: PUT
- uri: https://storagename.queue.core.windows.net/cont4db115a6
- response:
- body:
- string: ''
- headers:
- content-length:
- - '0'
- date:
- - Wed, 30 Oct 2019 19:51:39 GMT
- server:
- - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- x-ms-version:
- - '2018-03-28'
- status:
- code: 201
- message: Created
-- request:
- body: null
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:41 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/cont4db115a6?comp=metadata
- response:
- body:
- string: ''
- headers:
- cache-control:
- - no-cache
- content-length:
- - '0'
- date:
- - Wed, 30 Oct 2019 19:51:39 GMT
- server:
- - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- x-ms-approximate-messages-count:
- - '0'
- x-ms-meta-hello:
- - world
- x-ms-version:
- - '2018-03-28'
- status:
- code: 200
- message: OK
-- request:
- body: null
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- Content-Length:
- - '0'
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:41 GMT
- x-ms-version:
- - '2018-03-28'
- method: DELETE
- uri: https://storagename.queue.core.windows.net/cont4db115a6
- response:
- body:
- string: ''
- headers:
- content-length:
- - '0'
- date:
- - Wed, 30 Oct 2019 19:51:39 GMT
- server:
- - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- x-ms-version:
- - '2018-03-28'
- status:
- code: 204
- message: No Content
-version: 1
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_response_callback.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_response_callback.yaml
deleted file mode 100644
index 0d7b74f784d8..000000000000
--- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_response_callback.yaml
+++ /dev/null
@@ -1,39 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:41 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/cont5391106b?comp=metadata
- response:
- body:
- string: "\uFEFFQueueNotFoundThe
- specified queue does not exist.\nRequestId:ca02f24b-e003-0045-335b-8fd79b000000\nTime:2019-10-30T19:51:40.9556103Z"
- headers:
- content-length:
- - '217'
- content-type:
- - application/xml
- date:
- - Wed, 30 Oct 2019 19:51:40 GMT
- server:
- - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- x-ms-error-code:
- - QueueNotFound
- x-ms-version:
- - '2018-03-28'
- status:
- code: 404
- message: The specified queue does not exist.
-version: 1
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_user_agent_append.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_user_agent_append.yaml
deleted file mode 100644
index 5d43bb877ca6..000000000000
--- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_user_agent_append.yaml
+++ /dev/null
@@ -1,40 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- Accept:
- - application/xml
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- customer_user_agent
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:41 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/?restype=service&comp=properties
- response:
- body:
- string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse"
- headers:
- cache-control:
- - no-cache
- content-type:
- - application/xml
- date:
- - Wed, 30 Oct 2019 19:51:41 GMT
- server:
- - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- transfer-encoding:
- - chunked
- x-ms-version:
- - '2018-03-28'
- status:
- code: 200
- message: OK
-version: 1
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_user_agent_custom.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_user_agent_custom.yaml
deleted file mode 100644
index b4e808a8dba6..000000000000
--- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_user_agent_custom.yaml
+++ /dev/null
@@ -1,76 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- Accept:
- - application/xml
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- User-Agent:
- - TestApp/v1.0 azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:42 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/?restype=service&comp=properties
- response:
- body:
- string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse"
- headers:
- cache-control:
- - no-cache
- content-type:
- - application/xml
- date:
- - Wed, 30 Oct 2019 19:51:40 GMT
- server:
- - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- transfer-encoding:
- - chunked
- x-ms-version:
- - '2018-03-28'
- status:
- code: 200
- message: OK
-- request:
- body: null
- headers:
- Accept:
- - application/xml
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- User-Agent:
- - TestApp/v2.0 azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:42 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/?restype=service&comp=properties
- response:
- body:
- string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse"
- headers:
- cache-control:
- - no-cache
- content-type:
- - application/xml
- date:
- - Wed, 30 Oct 2019 19:51:40 GMT
- server:
- - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- transfer-encoding:
- - chunked
- x-ms-version:
- - '2018-03-28'
- status:
- code: 200
- message: OK
-version: 1
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_user_agent_default.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_user_agent_default.yaml
deleted file mode 100644
index 632131f58abd..000000000000
--- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client.test_user_agent_default.yaml
+++ /dev/null
@@ -1,39 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- Accept:
- - application/xml
- Accept-Encoding:
- - gzip, deflate
- Connection:
- - keep-alive
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:42 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/?restype=service&comp=properties
- response:
- body:
- string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse"
- headers:
- cache-control:
- - no-cache
- content-type:
- - application/xml
- date:
- - Wed, 30 Oct 2019 19:51:40 GMT
- server:
- - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- transfer-encoding:
- - chunked
- x-ms-version:
- - '2018-03-28'
- status:
- code: 200
- message: OK
-version: 1
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_request_callback_signed_header.json b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_request_callback_signed_header.json
new file mode 100644
index 000000000000..215b9edf7f0f
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_request_callback_signed_header.json
@@ -0,0 +1,80 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/cont92803599",
+ "RequestMethod": "PUT",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "Content-Length": "0",
+ "User-Agent": "azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:53:15 GMT",
+ "x-ms-meta-hello": "world",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 201,
+ "ResponseHeaders": {
+ "Content-Length": "0",
+ "Date": "Tue, 25 Oct 2022 21:53:18 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": null
+ },
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/cont92803599?comp=metadata",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "User-Agent": "azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:53:20 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Length": "0",
+ "Date": "Tue, 25 Oct 2022 21:53:18 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-approximate-messages-count": "0",
+ "x-ms-meta-hello": "world",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": null
+ },
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/cont92803599",
+ "RequestMethod": "DELETE",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "Content-Length": "0",
+ "User-Agent": "azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:53:20 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 204,
+ "ResponseHeaders": {
+ "Content-Length": "0",
+ "Date": "Tue, 25 Oct 2022 21:53:18 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": null
+ }
+ ],
+ "Variables": {}
+}
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_response_callback.json b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_response_callback.json
new file mode 100644
index 000000000000..5ae14ade6785
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_response_callback.json
@@ -0,0 +1,34 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/conteef7305e?comp=metadata",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "User-Agent": "azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:53:20 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 404,
+ "ResponseHeaders": {
+ "Content-Length": "217",
+ "Content-Type": "application/xml",
+ "Date": "Tue, 25 Oct 2022 21:53:19 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-error-code": "QueueNotFound",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": [
+ "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CError\u003E\u003CCode\u003EQueueNotFound\u003C/Code\u003E\u003CMessage\u003EThe specified queue does not exist.\n",
+ "RequestId:85db8fc7-a003-000f-37bc-e8804d000000\n",
+ "Time:2022-10-25T21:53:20.2414205Z\u003C/Message\u003E\u003C/Error\u003E"
+ ]
+ }
+ ],
+ "Variables": {}
+}
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_user_agent_append.json b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_user_agent_append.json
new file mode 100644
index 000000000000..36ed97a68eee
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_user_agent_append.json
@@ -0,0 +1,30 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/?restype=service\u0026comp=properties",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "User-Agent": "customer_user_agent azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:53:21 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Type": "application/xml",
+ "Date": "Tue, 25 Oct 2022 21:53:20 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "Transfer-Encoding": "chunked",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Efalse\u003C/Read\u003E\u003CWrite\u003Efalse\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E7\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003C/StorageServiceProperties\u003E"
+ }
+ ],
+ "Variables": {}
+}
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_user_agent_custom.json b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_user_agent_custom.json
new file mode 100644
index 000000000000..9939c8b07e99
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_user_agent_custom.json
@@ -0,0 +1,55 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/?restype=service\u0026comp=properties",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "User-Agent": "TestApp/v1.0 azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:53:21 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Type": "application/xml",
+ "Date": "Tue, 25 Oct 2022 21:53:20 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "Transfer-Encoding": "chunked",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Efalse\u003C/Read\u003E\u003CWrite\u003Efalse\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E7\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003C/StorageServiceProperties\u003E"
+ },
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/?restype=service\u0026comp=properties",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "User-Agent": "TestApp/v2.0 TestApp/v1.0 azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:53:21 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Type": "application/xml",
+ "Date": "Tue, 25 Oct 2022 21:53:20 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "Transfer-Encoding": "chunked",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Efalse\u003C/Read\u003E\u003CWrite\u003Efalse\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E7\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003C/StorageServiceProperties\u003E"
+ }
+ ],
+ "Variables": {}
+}
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_user_agent_default.json b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_user_agent_default.json
new file mode 100644
index 000000000000..1e1edc53d9b1
--- /dev/null
+++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.pyTestAsyncStorageQueueClienttest_user_agent_default.json
@@ -0,0 +1,30 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://storagename.queue.core.windows.net/?restype=service\u0026comp=properties",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/xml",
+ "Accept-Encoding": "gzip, deflate",
+ "User-Agent": "azsdk-python-storage-queue/12.5.1 Python/3.10.2 (Windows-10-10.0.19044-SP0)",
+ "x-ms-date": "Tue, 25 Oct 2022 21:53:20 GMT",
+ "x-ms-version": "2021-02-12"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Type": "application/xml",
+ "Date": "Tue, 25 Oct 2022 21:53:19 GMT",
+ "Server": [
+ "Windows-Azure-Queue/1.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "Transfer-Encoding": "chunked",
+ "x-ms-version": "2021-02-12"
+ },
+ "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Efalse\u003C/Read\u003E\u003CWrite\u003Efalse\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Etrue\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E7\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Efalse\u003C/Enabled\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors /\u003E\u003C/StorageServiceProperties\u003E"
+ }
+ ],
+ "Variables": {}
+}
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_request_callback_signed_header.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_request_callback_signed_header.yaml
deleted file mode 100644
index f783be99cf7b..000000000000
--- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_request_callback_signed_header.yaml
+++ /dev/null
@@ -1,97 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:42 GMT
- x-ms-meta-hello:
- - world
- x-ms-version:
- - '2018-03-28'
- method: PUT
- uri: https://storagename.queue.core.windows.net/contdaac1823
- response:
- body:
- string: ''
- headers:
- content-length: '0'
- date: Wed, 30 Oct 2019 19:51:42 GMT
- server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- x-ms-version: '2018-03-28'
- status:
- code: 201
- message: Created
- url: !!python/object/new:yarl.URL
- state: !!python/tuple
- - !!python/object/new:urllib.parse.SplitResult
- - https
- - pyacrstoragekiq3q5uw4eso.queue.core.windows.net
- - /contdaac1823
- - ''
- - ''
-- request:
- body: null
- headers:
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:43 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/contdaac1823?comp=metadata
- response:
- body:
- string: ''
- headers:
- cache-control: no-cache
- content-length: '0'
- date: Wed, 30 Oct 2019 19:51:42 GMT
- server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- x-ms-approximate-messages-count: '0'
- x-ms-meta-hello: world
- x-ms-version: '2018-03-28'
- status:
- code: 200
- message: OK
- url: !!python/object/new:yarl.URL
- state: !!python/tuple
- - !!python/object/new:urllib.parse.SplitResult
- - https
- - pyacrstoragekiq3q5uw4eso.queue.core.windows.net
- - /contdaac1823
- - comp=metadata
- - ''
-- request:
- body: null
- headers:
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:43 GMT
- x-ms-version:
- - '2018-03-28'
- method: DELETE
- uri: https://storagename.queue.core.windows.net/contdaac1823
- response:
- body:
- string: ''
- headers:
- content-length: '0'
- date: Wed, 30 Oct 2019 19:51:42 GMT
- server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- x-ms-version: '2018-03-28'
- status:
- code: 204
- message: No Content
- url: !!python/object/new:yarl.URL
- state: !!python/tuple
- - !!python/object/new:urllib.parse.SplitResult
- - https
- - pyacrstoragekiq3q5uw4eso.queue.core.windows.net
- - /contdaac1823
- - ''
- - ''
-version: 1
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_response_callback.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_response_callback.yaml
deleted file mode 100644
index 7dcae73c41de..000000000000
--- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_response_callback.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:43 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/contc03312e8?comp=metadata
- response:
- body:
- string: "\uFEFFQueueNotFoundThe
- specified queue does not exist.\nRequestId:e7edf344-6003-0032-205b-8f52da000000\nTime:2019-10-30T19:51:42.5605199Z"
- headers:
- content-length: '217'
- content-type: application/xml
- date: Wed, 30 Oct 2019 19:51:42 GMT
- server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- x-ms-error-code: QueueNotFound
- x-ms-version: '2018-03-28'
- status:
- code: 404
- message: The specified queue does not exist.
- url: !!python/object/new:yarl.URL
- state: !!python/tuple
- - !!python/object/new:urllib.parse.SplitResult
- - https
- - pyacrstoragekiq3q5uw4eso.queue.core.windows.net
- - /contc03312e8
- - comp=metadata
- - ''
-version: 1
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_user_agent_append.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_user_agent_append.yaml
deleted file mode 100644
index 443b86670c9b..000000000000
--- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_user_agent_append.yaml
+++ /dev/null
@@ -1,38 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- Accept:
- - application/xml
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- customer_user_agent
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:43 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/?restype=service&comp=properties
- response:
- body:
- string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse"
- headers:
- cache-control: no-cache
- content-type: application/xml
- date: Wed, 30 Oct 2019 19:51:42 GMT
- server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- transfer-encoding: chunked
- x-ms-version: '2018-03-28'
- status:
- code: 200
- message: OK
- url: !!python/object/new:yarl.URL
- state: !!python/tuple
- - !!python/object/new:urllib.parse.SplitResult
- - https
- - pyacrstoragekiq3q5uw4eso.queue.core.windows.net
- - /
- - restype=service&comp=properties
- - ''
-version: 1
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_user_agent_custom.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_user_agent_custom.yaml
deleted file mode 100644
index 4885a0f6942c..000000000000
--- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_user_agent_custom.yaml
+++ /dev/null
@@ -1,72 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- Accept:
- - application/xml
- User-Agent:
- - TestApp/v1.0 azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:43 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/?restype=service&comp=properties
- response:
- body:
- string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse"
- headers:
- cache-control: no-cache
- content-type: application/xml
- date: Wed, 30 Oct 2019 19:51:41 GMT
- server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- transfer-encoding: chunked
- x-ms-version: '2018-03-28'
- status:
- code: 200
- message: OK
- url: !!python/object/new:yarl.URL
- state: !!python/tuple
- - !!python/object/new:urllib.parse.SplitResult
- - https
- - pyacrstoragekiq3q5uw4eso.queue.core.windows.net
- - /
- - restype=service&comp=properties
- - ''
-- request:
- body: null
- headers:
- Accept:
- - application/xml
- User-Agent:
- - TestApp/v2.0 azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:43 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/?restype=service&comp=properties
- response:
- body:
- string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse"
- headers:
- cache-control: no-cache
- content-type: application/xml
- date: Wed, 30 Oct 2019 19:51:42 GMT
- server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- transfer-encoding: chunked
- x-ms-version: '2018-03-28'
- status:
- code: 200
- message: OK
- url: !!python/object/new:yarl.URL
- state: !!python/tuple
- - !!python/object/new:urllib.parse.SplitResult
- - https
- - pyacrstoragekiq3q5uw4eso.queue.core.windows.net
- - /
- - restype=service&comp=properties
- - ''
-version: 1
diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_user_agent_default.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_user_agent_default.yaml
deleted file mode 100644
index a5267030434c..000000000000
--- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue_client_async.test_user_agent_default.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- Accept:
- - application/xml
- User-Agent:
- - azsdk-python-storage-queue/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- x-ms-date:
- - Wed, 30 Oct 2019 19:51:43 GMT
- x-ms-version:
- - '2018-03-28'
- method: GET
- uri: https://storagename.queue.core.windows.net/?restype=service&comp=properties
- response:
- body:
- string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse"
- headers:
- cache-control: no-cache
- content-type: application/xml
- date: Wed, 30 Oct 2019 19:51:42 GMT
- server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
- transfer-encoding: chunked
- x-ms-version: '2018-03-28'
- status:
- code: 200
- message: OK
- url: !!python/object/new:yarl.URL
- state: !!python/tuple
- - !!python/object/new:urllib.parse.SplitResult
- - https
- - pyacrstoragekiq3q5uw4eso.queue.core.windows.net
- - /
- - restype=service&comp=properties
- - ''
-version: 1
diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_client.py b/sdk/storage/azure-storage-queue/tests/test_queue_client.py
index 1743c3f7a07b..c58c7152c34a 100644
--- a/sdk/storage/azure-storage-queue/tests/test_queue_client.py
+++ b/sdk/storage/azure-storage-queue/tests/test_queue_client.py
@@ -3,16 +3,23 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
-import unittest
import platform
+import unittest
+from datetime import datetime, timedelta
+
import pytest
from azure.storage.queue import (
- VERSION,
- QueueServiceClient,
+ AccountSasPermissions,
+ generate_account_sas,
QueueClient,
+ QueueServiceClient,
+ ResourceTypes,
+ VERSION
)
+
+from devtools_testutils import recorded_by_proxy
+from devtools_testutils.storage import StorageRecordedTestCase
from settings.testcase import QueuePreparer
-from devtools_testutils.storage import StorageTestCase
# ------------------------------------------------------------------------------
SERVICES = {
@@ -24,24 +31,38 @@
_CONNECTION_ENDPOINTS_SECONDARY = {'queue': 'QueueSecondaryEndpoint'}
-class StorageQueueClientTest(StorageTestCase):
+class TestStorageQueueClient(StorageRecordedTestCase):
def setUp(self):
- super(StorageQueueClientTest, self).setUp()
- self.sas_token = self.generate_sas_token()
+ self.sas_token = self.generate_fake_sas_token()
self.token_credential = self.generate_oauth_token()
# --Helpers-----------------------------------------------------------------
def validate_standard_account_endpoints(self, service, url_type, account_name, account_key):
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, account_name)
- self.assertEqual(service.credential.account_name, account_name)
- self.assertEqual(service.credential.account_key, account_key)
- self.assertTrue(f'{account_name}.{url_type}.core.windows.net' in service.url)
- self.assertTrue(f'{account_name}-secondary.{url_type}.core.windows.net' in service.secondary_endpoint)
+ assert service is not None
+ assert service.account_name == account_name
+ assert service.credential.account_name == account_name
+ assert service.credential.account_key == account_key
+ assert f'{account_name}.{url_type}.core.windows.net' in service.url
+ assert f'{account_name}-secondary.{url_type}.core.windows.net' in service.secondary_endpoint
+
+ def generate_fake_sas_token(self):
+ fake_key = "a" * 30 + "b" * 30
+
+ return "?" + generate_account_sas(
+ account_name="test", # name of the storage account
+ account_key=fake_key, # key for the storage account
+ resource_types=ResourceTypes(object=True),
+ permission=AccountSasPermissions(read=True, list=True),
+ start=datetime.now() - timedelta(hours=24),
+ expiry=datetime.now() + timedelta(days=8),
+ )
# --Direct Parameters Test Cases --------------------------------------------
@QueuePreparer()
- def test_create_service_with_key(self, storage_account_name, storage_account_key):
+ def test_create_service_with_key(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for client, url in SERVICES.items():
@@ -51,10 +72,13 @@ def test_create_service_with_key(self, storage_account_name, storage_account_key
# Assert
self.validate_standard_account_endpoints(service, url, storage_account_name, storage_account_key)
- self.assertEqual(service.scheme, 'https')
+ assert service.scheme == 'https'
@QueuePreparer()
- def test_create_service_with_connection_string(self, storage_account_name, storage_account_key):
+ def test_create_service_with_connection_string(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
for service_type in SERVICES.items():
# Act
@@ -64,10 +88,13 @@ def test_create_service_with_connection_string(self, storage_account_name, stora
# Assert
self.validate_standard_account_endpoints(
service, service_type[1], storage_account_name, storage_account_key)
- self.assertEqual(service.scheme, 'https')
+ assert service.scheme == 'https'
@QueuePreparer()
- def test_create_service_with_sas(self, storage_account_name, storage_account_key):
+ def test_create_service_with_sas(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES:
@@ -76,37 +103,48 @@ def test_create_service_with_sas(self, storage_account_name, storage_account_key
self.account_url(storage_account_name, "queue"), credential=self.sas_token, queue_name='foo')
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertTrue(service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net'))
- self.assertTrue(service.url.endswith(self.sas_token))
- self.assertIsNone(service.credential)
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net')
+ assert service.url.endswith(self.sas_token)
+ assert service.credential is None
@QueuePreparer()
- def test_create_service_with_token(self, storage_account_name, storage_account_key):
+ def test_create_service_with_token(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+ self.setUp()
+
for service_type in SERVICES:
# Act
service = service_type(
self.account_url(storage_account_name, "queue"), credential=self.token_credential, queue_name='foo')
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertTrue(service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net'))
- self.assertEqual(service.credential, self.token_credential)
- self.assertFalse(hasattr(service.credential, 'account_key'))
- self.assertTrue(hasattr(service.credential, 'get_token'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net')
+ assert service.credential == self.token_credential
+ assert not hasattr(service.credential, 'account_key')
+ assert hasattr(service.credential, 'get_token')
@QueuePreparer()
- def test_create_service_with_token_and_http(self, storage_account_name, storage_account_key):
+ def test_create_service_with_token_and_http(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+ self.setUp()
+
for service_type in SERVICES:
# Act
- with self.assertRaises(ValueError):
+ with pytest.raises(ValueError):
url = self.account_url(storage_account_name, "queue").replace('https', 'http')
service_type(url, credential=self.token_credential, queue_name='foo')
@QueuePreparer()
- def test_create_service_china(self, storage_account_name, storage_account_key):
+ def test_create_service_china(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
@@ -116,17 +154,18 @@ def test_create_service_china(self, storage_account_name, storage_account_key):
url, credential=storage_account_key, queue_name='foo')
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(service.primary_endpoint.startswith(
- f'https://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn'))
- self.assertTrue(service.secondary_endpoint.startswith(
- f'https://{storage_account_name}-secondary.{service_type[1]}.core.chinacloudapi.cn'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith(f'https://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn') is True
+ assert service.secondary_endpoint.startswith(f'https://{storage_account_name}-secondary.{service_type[1]}.core.chinacloudapi.cn') is True
@QueuePreparer()
- def test_create_service_protocol(self, storage_account_name, storage_account_key):
+ def test_create_service_protocol(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
@@ -138,23 +177,28 @@ def test_create_service_protocol(self, storage_account_name, storage_account_key
# Assert
self.validate_standard_account_endpoints(
service, service_type[1], storage_account_name, storage_account_key)
- self.assertEqual(service.scheme, 'http')
+ assert service.scheme == 'http'
@QueuePreparer()
- def test_create_service_empty_key(self, storage_account_name, storage_account_key):
+ def test_create_service_empty_key(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
QUEUE_SERVICES = [QueueServiceClient, QueueClient]
for service_type in QUEUE_SERVICES:
# Act
- with self.assertRaises(ValueError) as e:
+ with pytest.raises(ValueError) as e:
test_service = service_type('testaccount', credential='', queue_name='foo')
- self.assertEqual(
- str(e.exception), "You need to provide either a SAS token or an account shared key to authenticate.")
+ assert str(e.value) == "You need to provide either a SAS token or an account shared key to authenticate."
@QueuePreparer()
- def test_create_service_with_socket_timeout(self, storage_account_name, storage_account_key):
+ def test_create_service_with_socket_timeout(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
@@ -173,7 +217,10 @@ def test_create_service_with_socket_timeout(self, storage_account_name, storage_
# --Connection String Test Cases --------------------------------------------
@QueuePreparer()
- def test_create_service_with_connection_string_key(self, storage_account_name, storage_account_key):
+ def test_create_service_with_connection_string_key(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
conn_string = f'AccountName={storage_account_name};AccountKey={storage_account_key};'
@@ -184,10 +231,13 @@ def test_create_service_with_connection_string_key(self, storage_account_name, s
# Assert
self.validate_standard_account_endpoints(
service, service_type[1], storage_account_name, storage_account_key)
- self.assertEqual(service.scheme, 'https')
+ assert service.scheme == 'https'
@QueuePreparer()
- def test_create_service_with_connection_string_sas(self, storage_account_name, storage_account_key):
+ def test_create_service_with_connection_string_sas(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
conn_string = f'AccountName={storage_account_name};SharedAccessSignature={self.sas_token};'
@@ -196,14 +246,17 @@ def test_create_service_with_connection_string_sas(self, storage_account_name, s
service = service_type.from_connection_string(conn_string, queue_name='foo')
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertTrue(service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net'))
- self.assertTrue(service.url.endswith(self.sas_token))
- self.assertIsNone(service.credential)
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net')
+ assert service.url.endswith(self.sas_token)
+ assert service.credential is None
@QueuePreparer()
- def test_create_service_with_connection_string_endpoint_protocol(self, storage_account_name, storage_account_key):
+ def test_create_service_with_connection_string_endpoint_protocol(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
conn_string = (
f'AccountName={storage_account_name};'
@@ -217,17 +270,13 @@ def test_create_service_with_connection_string_endpoint_protocol(self, storage_a
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(
- service.primary_endpoint.startswith(
- f'http://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn/'))
- self.assertTrue(
- service.secondary_endpoint.startswith(
- f'http://{storage_account_name}-secondary.{service_type[1]}.core.chinacloudapi.cn'))
- self.assertEqual(service.scheme, 'http')
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith(f'http://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn/') is True
+ assert service.secondary_endpoint.startswith(f'http://{storage_account_name}-secondary.{service_type[1]}.core.chinacloudapi.cn') is True
+ assert service.scheme == 'http'
@QueuePreparer()
def test_create_service_with_connection_string_emulated(self, *args):
@@ -236,11 +285,14 @@ def test_create_service_with_connection_string_emulated(self, *args):
conn_string = 'UseDevelopmentStorage=true;'
# Act
- with self.assertRaises(ValueError):
+ with pytest.raises(ValueError):
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
@QueuePreparer()
- def test_create_service_with_connection_string_custom_domain(self, storage_account_name, storage_account_key):
+ def test_create_service_with_connection_string_custom_domain(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
conn_string = (
@@ -253,16 +305,18 @@ def test_create_service_with_connection_string_custom_domain(self, storage_accou
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com/'))
- self.assertTrue(service.secondary_endpoint.startswith(
- f'https://{storage_account_name}-secondary.queue.core.windows.net'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith('https://www.mydomain.com/')
+ assert service.secondary_endpoint.startswith(f'https://{storage_account_name}-secondary.queue.core.windows.net') is True
@QueuePreparer()
- def test_create_service_with_conn_str_custom_domain_trailing_slash(self, storage_account_name, storage_account_key):
+ def test_create_service_with_conn_str_custom_domain_trailing_slash(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
conn_string = (
@@ -274,16 +328,18 @@ def test_create_service_with_conn_str_custom_domain_trailing_slash(self, storage
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com/'))
- self.assertTrue(service.secondary_endpoint.startswith(
- f'https://{storage_account_name}-secondary.queue.core.windows.net'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith('https://www.mydomain.com/')
+ assert service.secondary_endpoint.startswith(f'https://{storage_account_name}-secondary.queue.core.windows.net') is True
@QueuePreparer()
- def test_create_service_with_conn_str_custom_domain_sec_override(self, storage_account_name, storage_account_key):
+ def test_create_service_with_conn_str_custom_domain_sec_override(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
conn_string = (
@@ -296,15 +352,18 @@ def test_create_service_with_conn_str_custom_domain_sec_override(self, storage_a
conn_string, secondary_hostname="www-sec.mydomain.com", queue_name="foo")
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com/'))
- self.assertTrue(service.secondary_endpoint.startswith('https://www-sec.mydomain.com/'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith('https://www.mydomain.com/')
+ assert service.secondary_endpoint.startswith('https://www-sec.mydomain.com/')
@QueuePreparer()
- def test_create_service_with_conn_str_fails_if_sec_without_primary(self, storage_account_name, storage_account_key):
+ def test_create_service_with_conn_str_fails_if_sec_without_primary(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
for service_type in SERVICES.items():
# Arrange
conn_string = (
@@ -315,11 +374,14 @@ def test_create_service_with_conn_str_fails_if_sec_without_primary(self, storage
# Act
# Fails if primary excluded
- with self.assertRaises(ValueError):
+ with pytest.raises(ValueError):
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
@QueuePreparer()
- def test_create_service_with_conn_str_succeeds_if_sec_with_primary(self, storage_account_name, storage_account_key):
+ def test_create_service_with_conn_str_succeeds_if_sec_with_primary(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
for service_type in SERVICES.items():
# Arrange
conn_string = (
@@ -332,15 +394,18 @@ def test_create_service_with_conn_str_succeeds_if_sec_with_primary(self, storage
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com/'))
- self.assertTrue(service.secondary_endpoint.startswith('https://www-sec.mydomain.com/'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith('https://www.mydomain.com/')
+ assert service.secondary_endpoint.startswith('https://www-sec.mydomain.com/')
@QueuePreparer()
- def test_create_service_with_custom_account_endpoint_path(self, storage_account_name, storage_account_key):
+ def test_create_service_with_custom_account_endpoint_path(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
custom_account_url = "http://local-machine:11002/custom/account/path/" + self.sas_token
for service_type in SERVICES.items():
conn_string = (
@@ -353,33 +418,37 @@ def test_create_service_with_custom_account_endpoint_path(self, storage_account_
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
# Assert
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertEqual(service.primary_hostname, 'local-machine:11002/custom/account/path')
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_hostname == 'local-machine:11002/custom/account/path'
service = QueueServiceClient(account_url=custom_account_url)
- self.assertEqual(service.account_name, None)
- self.assertEqual(service.credential, None)
- self.assertEqual(service.primary_hostname, 'local-machine:11002/custom/account/path')
- self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path/?'))
+ assert service.account_name == None
+ assert service.credential == None
+ assert service.primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.url.startswith('http://local-machine:11002/custom/account/path/?')
service = QueueClient(account_url=custom_account_url, queue_name="foo")
- self.assertEqual(service.account_name, None)
- self.assertEqual(service.queue_name, "foo")
- self.assertEqual(service.credential, None)
- self.assertEqual(service.primary_hostname, 'local-machine:11002/custom/account/path')
- self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path/foo?'))
+ assert service.account_name == None
+ assert service.queue_name == "foo"
+ assert service.credential == None
+ assert service.primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.url.startswith('http://local-machine:11002/custom/account/path/foo?')
service = QueueClient.from_queue_url("http://local-machine:11002/custom/account/path/foo" + self.sas_token)
- self.assertEqual(service.account_name, None)
- self.assertEqual(service.queue_name, "foo")
- self.assertEqual(service.credential, None)
- self.assertEqual(service.primary_hostname, 'local-machine:11002/custom/account/path')
- self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path/foo?'))
+ assert service.account_name == None
+ assert service.queue_name == "foo"
+ assert service.credential == None
+ assert service.primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.url.startswith('http://local-machine:11002/custom/account/path/foo?')
@QueuePreparer()
- def test_request_callback_signed_header(self, storage_account_name, storage_account_key):
+ @recorded_by_proxy
+ def test_request_callback_signed_header(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key)
name = self.get_resource_name('cont')
@@ -391,12 +460,16 @@ def test_request_callback_signed_header(self, storage_account_name, storage_acco
# Assert
metadata = queue.get_queue_properties().metadata
- self.assertEqual(metadata, {'hello': 'world'})
+ assert metadata == {'hello': 'world'}
finally:
service.delete_queue(name)
@QueuePreparer()
- def test_response_callback(self, storage_account_name, storage_account_key):
+ @recorded_by_proxy
+ def test_response_callback(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key)
name = self.get_resource_name('cont')
@@ -409,26 +482,34 @@ def callback(response):
# Assert
exists = queue.get_queue_properties(raw_response_hook=callback)
- self.assertTrue(exists)
+ assert exists
@QueuePreparer()
- def test_user_agent_default(self, storage_account_name, storage_account_key):
+ @recorded_by_proxy
+ def test_user_agent_default(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key)
def callback(response):
- self.assertTrue('User-Agent' in response.http_request.headers)
+ assert 'User-Agent' in response.http_request.headers
assert f"azsdk-python-storage-queue/{VERSION}" in response.http_request.headers['User-Agent']
service.get_service_properties(raw_response_hook=callback)
@QueuePreparer()
- def test_user_agent_custom(self, storage_account_name, storage_account_key):
+ @recorded_by_proxy
+ def test_user_agent_custom(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
custom_app = "TestApp/v1.0"
service = QueueServiceClient(
self.account_url(storage_account_name, "queue"), credential=storage_account_key, user_agent=custom_app)
def callback(response):
- self.assertTrue('User-Agent' in response.http_request.headers)
+ assert 'User-Agent' in response.http_request.headers
assert (
f"TestApp/v1.0 azsdk-python-storage-queue/{VERSION} "
f"Python/{platform.python_version()} "
@@ -438,7 +519,7 @@ def callback(response):
service.get_service_properties(raw_response_hook=callback)
def callback(response):
- self.assertTrue('User-Agent' in response.http_request.headers)
+ assert 'User-Agent' in response.http_request.headers
assert (
f"TestApp/v2.0 TestApp/v1.0 azsdk-python-storage-queue/{VERSION} "
f"Python/{platform.python_version()} ({platform.platform()})"
@@ -447,11 +528,15 @@ def callback(response):
service.get_service_properties(raw_response_hook=callback, user_agent="TestApp/v2.0")
@QueuePreparer()
- def test_user_agent_append(self, storage_account_name, storage_account_key):
+ @recorded_by_proxy
+ def test_user_agent_append(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key)
def callback(response):
- self.assertTrue('User-Agent' in response.http_request.headers)
+ assert 'User-Agent' in response.http_request.headers
assert (
f"customer_user_agent azsdk-python-storage-queue/{VERSION} "
f"Python/{platform.python_version()} ({platform.platform()})"
@@ -460,14 +545,17 @@ def callback(response):
service.get_service_properties(raw_response_hook=callback, user_agent='customer_user_agent')
@QueuePreparer()
- def test_create_queue_client_with_complete_queue_url(self, storage_account_name, storage_account_key):
+ def test_create_queue_client_with_complete_queue_url(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
queue_url = self.account_url(storage_account_name, "queue") + "/foo"
service = QueueClient(queue_url, queue_name='bar', credential=storage_account_key)
# Assert
- self.assertEqual(service.scheme, 'https')
- self.assertEqual(service.queue_name, 'bar')
+ assert service.scheme == 'https'
+ assert service.queue_name == 'bar'
def test_error_with_malformed_conn_str(self):
# Arrange
@@ -475,18 +563,19 @@ def test_error_with_malformed_conn_str(self):
for conn_str in ["", "foobar", "foobar=baz=foo", "foo;bar;baz", "foo=;bar=;", "=", ";", "=;=="]:
for service_type in SERVICES.items():
# Act
- with self.assertRaises(ValueError) as e:
+ with pytest.raises(ValueError) as e:
service = service_type[0].from_connection_string(conn_str, queue_name="test")
if conn_str in("", "foobar", "foo;bar;baz", ";"):
- self.assertEqual(
- str(e.exception), "Connection string is either blank or malformed.")
+ assert str(e.value) == "Connection string is either blank or malformed."
elif conn_str in ("foobar=baz=foo" , "foo=;bar=;", "=", "=;=="):
- self.assertEqual(
- str(e.exception), "Connection string missing required connection details.")
+ assert str(e.value) == "Connection string missing required connection details."
@QueuePreparer()
- def test_closing_pipeline_client(self, storage_account_name, storage_account_key):
+ def test_closing_pipeline_client(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for client, url in SERVICES.items():
# Act
@@ -499,7 +588,10 @@ def test_closing_pipeline_client(self, storage_account_name, storage_account_key
service.close()
@QueuePreparer()
- def test_closing_pipeline_client_simple(self, storage_account_name, storage_account_key):
+ def test_closing_pipeline_client_simple(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for client, url in SERVICES.items():
# Act
diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_client_async.py b/sdk/storage/azure-storage-queue/tests/test_queue_client_async.py
index 412209f526f0..7e2af1a86979 100644
--- a/sdk/storage/azure-storage-queue/tests/test_queue_client_async.py
+++ b/sdk/storage/azure-storage-queue/tests/test_queue_client_async.py
@@ -3,19 +3,16 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
+import platform
import unittest
+from datetime import datetime, timedelta
+
import pytest
-import platform
-import asyncio
-
-from azure.core.pipeline.transport import AioHttpTransport
-from multidict import CIMultiDict, CIMultiDictProxy
-from azure.storage.queue import VERSION
-from azure.storage.queue.aio import (
- QueueServiceClient,
- QueueClient
-)
-from devtools_testutils.storage.aio import AsyncStorageTestCase
+from azure.storage.queue import AccountSasPermissions, generate_account_sas, ResourceTypes, VERSION
+from azure.storage.queue.aio import QueueClient, QueueServiceClient
+
+from devtools_testutils.aio import recorded_by_proxy_async
+from devtools_testutils.storage.aio import AsyncStorageRecordedTestCase
from settings.testcase import QueuePreparer
# ------------------------------------------------------------------------------
@@ -28,48 +25,54 @@
_CONNECTION_ENDPOINTS_SECONDARY = {'queue': 'QueueSecondaryEndpoint'}
-class AiohttpTestTransport(AioHttpTransport):
- """Workaround to vcrpy bug: https://github.com/kevin1024/vcrpy/pull/461
- """
- async def send(self, request, **config):
- response = await super(AiohttpTestTransport, self).send(request, **config)
- if not isinstance(response.headers, CIMultiDictProxy):
- response.headers = CIMultiDictProxy(CIMultiDict(response.internal_response.headers))
- response.content_type = response.headers.get("content-type")
- return response
-
-
-class StorageQueueClientTestAsync(AsyncStorageTestCase):
+class TestAsyncStorageQueueClient(AsyncStorageRecordedTestCase):
def setUp(self):
- super(StorageQueueClientTestAsync, self).setUp()
- self.sas_token = self.generate_sas_token()
+ self.sas_token = self.generate_fake_sas_token()
self.token_credential = self.generate_oauth_token()
# --Helpers-----------------------------------------------------------------
def validate_standard_account_endpoints(self, service, url_type, storage_account_name, storage_account_key):
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(f'{storage_account_name}.{url_type}.core.windows.net' in service.url)
- self.assertTrue(f'{storage_account_name}-secondary.{url_type}.core.windows.net' in service.secondary_endpoint)
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert f'{storage_account_name}.{url_type}.core.windows.net' in service.url
+ assert f'{storage_account_name}-secondary.{url_type}.core.windows.net' in service.secondary_endpoint
+
+ def generate_fake_sas_token(self):
+ fake_key = "a" * 30 + "b" * 30
+
+ return "?" + generate_account_sas(
+ account_name="test", # name of the storage account
+ account_key=fake_key, # key for the storage account
+ resource_types=ResourceTypes(object=True),
+ permission=AccountSasPermissions(read=True, list=True),
+ start=datetime.now() - timedelta(hours=24),
+ expiry=datetime.now() + timedelta(days=8),
+ )
# --Direct Parameters Test Cases --------------------------------------------
@QueuePreparer()
- def test_create_service_with_key(self, storage_account_name, storage_account_key):
+ def test_create_service_with_key(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for client, url in SERVICES.items():
# Act
service = client(
- self.account_url(storage_account_name, "queue"), credential=storage_account_key, queue_name='foo', transport=AiohttpTestTransport())
+ self.account_url(storage_account_name, "queue"), credential=storage_account_key, queue_name='foo')
# Assert
self.validate_standard_account_endpoints(service, url, storage_account_name, storage_account_key)
- self.assertEqual(service.scheme, 'https')
+ assert service.scheme == 'https'
@QueuePreparer()
- def test_create_service_with_connection_string(self, storage_account_name, storage_account_key):
+ def test_create_service_with_connection_string(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
for service_type in SERVICES.items():
# Act
@@ -78,10 +81,13 @@ def test_create_service_with_connection_string(self, storage_account_name, stora
# Assert
self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key)
- self.assertEqual(service.scheme, 'https')
+ assert service.scheme == 'https'
@QueuePreparer()
- def test_create_service_with_sas(self, storage_account_name, storage_account_key):
+ def test_create_service_with_sas(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES:
@@ -90,37 +96,48 @@ def test_create_service_with_sas(self, storage_account_name, storage_account_key
self.account_url(storage_account_name, "queue"), credential=self.sas_token, queue_name='foo')
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertTrue(service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net'))
- self.assertTrue(service.url.endswith(self.sas_token))
- self.assertIsNone(service.credential)
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net')
+ assert service.url.endswith(self.sas_token)
+ assert service.credential is None
@QueuePreparer()
- def test_create_service_with_token(self, storage_account_name, storage_account_key):
+ def test_create_service_with_token(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+ self.setUp()
+
for service_type in SERVICES:
# Act
service = service_type(
self.account_url(storage_account_name, "queue"), credential=self.token_credential, queue_name='foo')
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertTrue(service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net'))
- self.assertEqual(service.credential, self.token_credential)
- self.assertFalse(hasattr(service.credential, 'account_key'))
- self.assertTrue(hasattr(service.credential, 'get_token'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net')
+ assert service.credential == self.token_credential
+ assert not hasattr(service.credential, 'account_key')
+ assert hasattr(service.credential, 'get_token')
@QueuePreparer()
- def test_create_service_with_token_and_http(self, storage_account_name, storage_account_key):
+ def test_create_service_with_token_and_http(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+ self.setUp()
+
for service_type in SERVICES:
# Act
- with self.assertRaises(ValueError):
+ with pytest.raises(ValueError):
url = self.account_url(storage_account_name, "queue").replace('https', 'http')
service_type(url, credential=self.token_credential, queue_name='foo')
@QueuePreparer()
- def test_create_service_china(self, storage_account_name, storage_account_key):
+ def test_create_service_china(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
@@ -130,17 +147,18 @@ def test_create_service_china(self, storage_account_name, storage_account_key):
url, credential=storage_account_key, queue_name='foo')
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(service.primary_endpoint.startswith(
- f'https://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn'))
- self.assertTrue(service.secondary_endpoint.startswith(
- f'https://{storage_account_name}-secondary.{service_type[1]}.core.chinacloudapi.cn'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith(f'https://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn') is True
+ assert service.secondary_endpoint.startswith(f'https://{storage_account_name}-secondary.{service_type[1]}.core.chinacloudapi.cn') is True
@QueuePreparer()
- def test_create_service_protocol(self, storage_account_name, storage_account_key):
+ def test_create_service_protocol(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
@@ -151,23 +169,28 @@ def test_create_service_protocol(self, storage_account_name, storage_account_key
# Assert
self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key)
- self.assertEqual(service.scheme, 'http')
+ assert service.scheme == 'http'
@QueuePreparer()
- def test_create_service_empty_key(self, storage_account_name, storage_account_key):
+ def test_create_service_empty_key(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
QUEUE_SERVICES = [QueueServiceClient, QueueClient]
for service_type in QUEUE_SERVICES:
# Act
- with self.assertRaises(ValueError) as e:
+ with pytest.raises(ValueError) as e:
test_service = service_type('testaccount', credential='', queue_name='foo')
- self.assertEqual(
- str(e.exception), "You need to provide either a SAS token or an account shared key to authenticate.")
+ assert str(e.value) == "You need to provide either a SAS token or an account shared key to authenticate."
@QueuePreparer()
- def test_create_service_with_socket_timeout(self, storage_account_name, storage_account_key):
+ def test_create_service_with_socket_timeout(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
@@ -185,7 +208,10 @@ def test_create_service_with_socket_timeout(self, storage_account_name, storage_
# --Connection String Test Cases --------------------------------------------
@QueuePreparer()
- def test_create_service_with_connection_string_key(self, storage_account_name, storage_account_key):
+ def test_create_service_with_connection_string_key(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
conn_string = (
f'AccountName={storage_account_name};'
@@ -197,10 +223,13 @@ def test_create_service_with_connection_string_key(self, storage_account_name, s
# Assert
self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key)
- self.assertEqual(service.scheme, 'https')
+ assert service.scheme == 'https'
@QueuePreparer()
- def test_create_service_with_connection_string_sas(self, storage_account_name, storage_account_key):
+ def test_create_service_with_connection_string_sas(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
conn_string = (
f'AccountName={storage_account_name};'
@@ -212,14 +241,17 @@ def test_create_service_with_connection_string_sas(self, storage_account_name, s
service = service_type.from_connection_string(conn_string, queue_name='foo')
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertTrue(service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net'))
- self.assertTrue(service.url.endswith(self.sas_token))
- self.assertIsNone(service.credential)
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.url.startswith('https://' + storage_account_name + '.queue.core.windows.net')
+ assert service.url.endswith(self.sas_token)
+ assert service.credential is None
@QueuePreparer()
- def test_create_service_with_conn_str_endpoint_protocol(self, storage_account_name, storage_account_key):
+ def test_create_service_with_conn_str_endpoint_protocol(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
conn_string = (
f'AccountName={storage_account_name};'
@@ -232,17 +264,13 @@ def test_create_service_with_conn_str_endpoint_protocol(self, storage_account_na
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(
- service.primary_endpoint.startswith(
- f'http://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn/'))
- self.assertTrue(
- service.secondary_endpoint.startswith(
- f'http://{storage_account_name}-secondary.{service_type[1]}.core.chinacloudapi.cn'))
- self.assertEqual(service.scheme, 'http')
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith(f'http://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn/') is True
+ assert service.secondary_endpoint.startswith(f'http://{storage_account_name}-secondary.{service_type[1]}.core.chinacloudapi.cn') is True
+ assert service.scheme == 'http'
@QueuePreparer()
def test_create_service_with_connection_string_emulated(self, *args):
@@ -251,11 +279,14 @@ def test_create_service_with_connection_string_emulated(self, *args):
conn_string = 'UseDevelopmentStorage=true;'
# Act
- with self.assertRaises(ValueError):
+ with pytest.raises(ValueError):
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
@QueuePreparer()
- def test_create_service_with_connection_string_custom_domain(self, storage_account_name, storage_account_key):
+ def test_create_service_with_connection_string_custom_domain(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
conn_string = (
@@ -267,15 +298,18 @@ def test_create_service_with_connection_string_custom_domain(self, storage_accou
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com/'))
- self.assertTrue(service.secondary_endpoint.startswith(f'https://{storage_account_name}-secondary.queue.core.windows.net'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith('https://www.mydomain.com/')
+ assert service.secondary_endpoint.startswith(f'https://{storage_account_name}-secondary.queue.core.windows.net')
@QueuePreparer()
- def test_create_serv_with_cs_custom_dmn_trlng_slash(self, storage_account_name, storage_account_key):
+ def test_create_serv_with_cs_custom_dmn_trlng_slash(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
conn_string = (
@@ -287,16 +321,19 @@ def test_create_serv_with_cs_custom_dmn_trlng_slash(self, storage_account_name,
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com/'))
- self.assertTrue(service.secondary_endpoint.startswith(f'https://{storage_account_name}-secondary.queue.core.windows.net'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith('https://www.mydomain.com/')
+ assert service.secondary_endpoint.startswith(f'https://{storage_account_name}-secondary.queue.core.windows.net')
@QueuePreparer()
- def test_create_service_with_cs_custom_dmn_sec_override(self, storage_account_name, storage_account_key):
+ def test_create_service_with_cs_custom_dmn_sec_override(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for service_type in SERVICES.items():
conn_string = (
@@ -309,15 +346,18 @@ def test_create_service_with_cs_custom_dmn_sec_override(self, storage_account_na
conn_string, secondary_hostname="www-sec.mydomain.com", queue_name="foo")
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com/'))
- self.assertTrue(service.secondary_endpoint.startswith('https://www-sec.mydomain.com/'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith('https://www.mydomain.com/')
+ assert service.secondary_endpoint.startswith('https://www-sec.mydomain.com/')
@QueuePreparer()
- def test_create_service_with_cs_fails_if_sec_without_prim(self, storage_account_name, storage_account_key):
+ def test_create_service_with_cs_fails_if_sec_without_prim(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
for service_type in SERVICES.items():
# Arrange
conn_string = (
@@ -328,11 +368,14 @@ def test_create_service_with_cs_fails_if_sec_without_prim(self, storage_account_
# Act
# Fails if primary excluded
- with self.assertRaises(ValueError):
+ with pytest.raises(ValueError):
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
@QueuePreparer()
- def test_create_service_with_cs_succeeds_if_sec_with_prim(self, storage_account_name, storage_account_key):
+ def test_create_service_with_cs_succeeds_if_sec_with_prim(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
for service_type in SERVICES.items():
# Arrange
conn_string = (
@@ -345,15 +388,18 @@ def test_create_service_with_cs_succeeds_if_sec_with_prim(self, storage_account_
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
# Assert
- self.assertIsNotNone(service)
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertTrue(service.primary_endpoint.startswith('https://www.mydomain.com/'))
- self.assertTrue(service.secondary_endpoint.startswith('https://www-sec.mydomain.com/'))
+ assert service is not None
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_endpoint.startswith('https://www.mydomain.com/')
+ assert service.secondary_endpoint.startswith('https://www-sec.mydomain.com/')
@QueuePreparer()
- def test_create_service_with_custom_account_endpoint_path(self, storage_account_name, storage_account_key):
+ def test_create_service_with_custom_account_endpoint_path(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
custom_account_url = "http://local-machine:11002/custom/account/path/" + self.sas_token
for service_type in SERVICES.items():
conn_string = (
@@ -365,34 +411,37 @@ def test_create_service_with_custom_account_endpoint_path(self, storage_account_
service = service_type[0].from_connection_string(conn_string, queue_name="foo")
# Assert
- self.assertEqual(service.account_name, storage_account_name)
- self.assertEqual(service.credential.account_name, storage_account_name)
- self.assertEqual(service.credential.account_key, storage_account_key)
- self.assertEqual(service.primary_hostname, 'local-machine:11002/custom/account/path')
+ assert service.account_name == storage_account_name
+ assert service.credential.account_name == storage_account_name
+ assert service.credential.account_key == storage_account_key
+ assert service.primary_hostname == 'local-machine:11002/custom/account/path'
service = QueueServiceClient(account_url=custom_account_url)
- self.assertEqual(service.account_name, None)
- self.assertEqual(service.credential, None)
- self.assertEqual(service.primary_hostname, 'local-machine:11002/custom/account/path')
- self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path/?'))
+ assert service.account_name == None
+ assert service.credential == None
+ assert service.primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.url.startswith('http://local-machine:11002/custom/account/path/?')
service = QueueClient(account_url=custom_account_url, queue_name="foo")
- self.assertEqual(service.account_name, None)
- self.assertEqual(service.queue_name, "foo")
- self.assertEqual(service.credential, None)
- self.assertEqual(service.primary_hostname, 'local-machine:11002/custom/account/path')
- self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path/foo?'))
+ assert service.account_name == None
+ assert service.queue_name == "foo"
+ assert service.credential == None
+ assert service.primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.url.startswith('http://local-machine:11002/custom/account/path/foo?')
service = QueueClient.from_queue_url("http://local-machine:11002/custom/account/path/foo" + self.sas_token)
- self.assertEqual(service.account_name, None)
- self.assertEqual(service.queue_name, "foo")
- self.assertEqual(service.credential, None)
- self.assertEqual(service.primary_hostname, 'local-machine:11002/custom/account/path')
- self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path/foo?'))
+ assert service.account_name == None
+ assert service.queue_name == "foo"
+ assert service.credential == None
+ assert service.primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.url.startswith('http://local-machine:11002/custom/account/path/foo?')
@QueuePreparer()
- @AsyncStorageTestCase.await_prepared_test
- async def test_request_callback_signed_header(self, storage_account_name, storage_account_key):
+ @recorded_by_proxy_async
+ async def test_request_callback_signed_header(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key)
name = self.get_resource_name('cont')
@@ -405,15 +454,18 @@ async def test_request_callback_signed_header(self, storage_account_name, storag
# Assert
metadata_cr = await queue.get_queue_properties()
metadata = metadata_cr.metadata
- self.assertEqual(metadata, {'hello': 'world'})
+ assert metadata == {'hello': 'world'}
finally:
await service.delete_queue(name)
@QueuePreparer()
- @AsyncStorageTestCase.await_prepared_test
- async def test_response_callback(self, storage_account_name, storage_account_key):
+ @recorded_by_proxy_async
+ async def test_response_callback(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
- service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key, transport=AiohttpTestTransport())
+ service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key)
name = self.get_resource_name('cont')
queue = service.get_queue_client(name)
@@ -424,28 +476,34 @@ def callback(response):
# Assert
exists = await queue.get_queue_properties(raw_response_hook=callback)
- self.assertTrue(exists)
+ assert exists
@QueuePreparer()
- @AsyncStorageTestCase.await_prepared_test
- async def test_user_agent_default(self, storage_account_name, storage_account_key):
- service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key, transport=AiohttpTestTransport())
+ @recorded_by_proxy_async
+ async def test_user_agent_default(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
+ service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key)
def callback(response):
- self.assertTrue('User-Agent' in response.http_request.headers)
+ assert 'User-Agent' in response.http_request.headers
assert f"azsdk-python-storage-queue/{VERSION}" in response.http_request.headers['User-Agent']
await service.get_service_properties(raw_response_hook=callback)
@QueuePreparer()
- @AsyncStorageTestCase.await_prepared_test
- async def test_user_agent_custom(self, storage_account_name, storage_account_key):
+ @recorded_by_proxy_async
+ async def test_user_agent_custom(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
custom_app = "TestApp/v1.0"
service = QueueServiceClient(
- self.account_url(storage_account_name, "queue"), credential=storage_account_key, user_agent=custom_app, transport=AiohttpTestTransport())
+ self.account_url(storage_account_name, "queue"), credential=storage_account_key, user_agent=custom_app)
def callback(response):
- self.assertTrue('User-Agent' in response.http_request.headers)
+ assert 'User-Agent' in response.http_request.headers
assert (
f"TestApp/v1.0 azsdk-python-storage-queue/{VERSION} "
f"Python/{platform.python_version()} "
@@ -454,7 +512,7 @@ def callback(response):
await service.get_service_properties(raw_response_hook=callback)
def callback(response):
- self.assertTrue('User-Agent' in response.http_request.headers)
+ assert 'User-Agent' in response.http_request.headers
assert (
f"TestApp/v2.0 TestApp/v1.0 azsdk-python-storage-queue/{VERSION} "
f"Python/{platform.python_version()} ({platform.platform()})"
@@ -463,12 +521,15 @@ def callback(response):
await service.get_service_properties(raw_response_hook=callback, user_agent="TestApp/v2.0")
@QueuePreparer()
- @AsyncStorageTestCase.await_prepared_test
- async def test_user_agent_append(self, storage_account_name, storage_account_key):
- service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key, transport=AiohttpTestTransport())
+ @recorded_by_proxy_async
+ async def test_user_agent_append(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
+ service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key)
def callback(response):
- self.assertTrue('User-Agent' in response.http_request.headers)
+ assert 'User-Agent' in response.http_request.headers
assert (f"customer_user_agent azsdk-python-storage-queue/{VERSION} "
f"Python/{platform.python_version()} ({platform.platform()})"
) in response.http_request.headers['User-Agent']
@@ -476,8 +537,10 @@ def callback(response):
await service.get_service_properties(raw_response_hook=callback, user_agent='customer_user_agent')
@QueuePreparer()
- @AsyncStorageTestCase.await_prepared_test
- async def test_closing_pipeline_client_async(self, storage_account_name, storage_account_key):
+ async def test_closing_pipeline_client(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for client, url in SERVICES.items():
# Act
@@ -490,8 +553,10 @@ async def test_closing_pipeline_client_async(self, storage_account_name, storage
await service.close()
@QueuePreparer()
- @AsyncStorageTestCase.await_prepared_test
- async def test_closing_pipeline_client_simple_async(self, storage_account_name, storage_account_key):
+ async def test_closing_pipeline_client_simple(self, **kwargs):
+ storage_account_name = kwargs.pop("storage_account_name")
+ storage_account_key = kwargs.pop("storage_account_key")
+
# Arrange
for client, url in SERVICES.items():
# Act