From e75c30b41f0364699c5a74e238b41e16db71fb47 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Thu, 10 Sep 2020 11:43:56 -0700 Subject: [PATCH 01/11] changes for test_table.py --- .../azure/data/tables/_table_client.py | 2 +- .../test_table.test_create_properties.yaml | 281 ++++++++++++++++++ ...le.test_query_tables_with_num_results.yaml | 90 +++--- ...able_acl_with_empty_signed_identifier.yaml | 50 ++-- ...ble_acl_with_empty_signed_identifiers.yaml | 50 ++-- .../azure-data-tables/tests/test_table.py | 33 +- 6 files changed, 386 insertions(+), 120 deletions(-) create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_properties.yaml diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py index a9646ed546e5..f9489e6568be 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py @@ -155,7 +155,7 @@ def get_table_access_policy( **kwargs) except HttpResponseError as error: _process_table_error(error) - return {s.id: s.access_policy or AccessPolicy() for s in identifiers} # pylint: disable=E1125 + return {s.id: s.access_policy or AccessPolicy(start=None, expiry=None, permission=None) for s in identifiers} # pylint: disable=E1125 @distributed_trace def set_table_access_policy( diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_properties.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_properties.yaml new file mode 100644 index 000000000000..5356f4530f4c --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_create_properties.yaml @@ -0,0 +1,281 @@ +interactions: +- request: + body: '{"TableName": "pytablesynce4f40d95"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 10 Sep 2020 18:42:48 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 18:42:48 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesynce4f40d95"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 10 Sep 2020 18:42:46 GMT + location: + - https://storagename.table.core.windows.net/Tables('pytablesynce4f40d95') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 10 Sep 2020 18:42:48 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 18:42:48 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse" + headers: + content-type: + - application/xml + date: + - Thu, 10 Sep 2020 18:42:46 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-02-02' + status: + code: 200 + message: OK +- request: + body: ' + + 1.0falsefalsetruefalse' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '251' + Content-Type: + - application/xml + Date: + - Thu, 10 Sep 2020 18:42:48 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 18:42:48 GMT + x-ms-version: + - '2019-02-02' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: '' + headers: + date: + - Thu, 10 Sep 2020 18:42:46 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-02-02' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 10 Sep 2020 18:42:48 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 18:42:48 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse" + headers: + content-type: + - application/xml + date: + - Thu, 10 Sep 2020 18:42:46 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-02-02' + status: + code: 200 + message: OK +- request: + body: ' + + 1.0truetruetrue5' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '271' + Content-Type: + - application/xml + Date: + - Thu, 10 Sep 2020 18:42:49 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 18:42:49 GMT + x-ms-version: + - '2019-02-02' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: '' + headers: + date: + - Thu, 10 Sep 2020 18:42:46 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-02-02' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 10 Sep 2020 18:42:49 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 18:42:49 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse" + headers: + content-type: + - application/xml + date: + - Thu, 10 Sep 2020 18:42:46 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-ms-version: + - '2019-02-02' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 10 Sep 2020 18:42:49 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 18:42:49 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytablesynce4f40d95') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 10 Sep 2020 18:42:46 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_num_results.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_num_results.yaml index 211d5ef111dd..cb1d58ad503d 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_num_results.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_query_tables_with_num_results.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: !!python/unicode '{"TableName": "listtable0aab312c0"}' + body: '{"TableName": "listtable0aab312c0"}' headers: Accept: - application/json;odata=minimalmetadata @@ -15,27 +15,27 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:05 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/2.7.18 (Windows-10-10.0.19041) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:05 GMT x-ms-version: - '2019-02-02' method: POST - uri: !!python/unicode https://storagename.table.core.windows.net/Tables + uri: https://storagename.table.core.windows.net/Tables response: body: - string: !!python/unicode '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable0aab312c0"}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable0aab312c0"}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:03 GMT location: - - !!python/unicode https://storagename.table.core.windows.net/Tables('listtable0aab312c0') + - https://storagename.table.core.windows.net/Tables('listtable0aab312c0') server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -48,7 +48,7 @@ interactions: code: 201 message: Created - request: - body: !!python/unicode '{"TableName": "listtable1aab312c0"}' + body: '{"TableName": "listtable1aab312c0"}' headers: Accept: - application/json;odata=minimalmetadata @@ -63,27 +63,27 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:05 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/2.7.18 (Windows-10-10.0.19041) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:05 GMT x-ms-version: - '2019-02-02' method: POST - uri: !!python/unicode https://storagename.table.core.windows.net/Tables + uri: https://storagename.table.core.windows.net/Tables response: body: - string: !!python/unicode '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable1aab312c0"}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable1aab312c0"}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:03 GMT location: - - !!python/unicode https://storagename.table.core.windows.net/Tables('listtable1aab312c0') + - https://storagename.table.core.windows.net/Tables('listtable1aab312c0') server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -96,7 +96,7 @@ interactions: code: 201 message: Created - request: - body: !!python/unicode '{"TableName": "listtable2aab312c0"}' + body: '{"TableName": "listtable2aab312c0"}' headers: Accept: - application/json;odata=minimalmetadata @@ -111,27 +111,27 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:05 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/2.7.18 (Windows-10-10.0.19041) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:05 GMT x-ms-version: - '2019-02-02' method: POST - uri: !!python/unicode https://storagename.table.core.windows.net/Tables + uri: https://storagename.table.core.windows.net/Tables response: body: - string: !!python/unicode '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable2aab312c0"}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable2aab312c0"}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:03 GMT location: - - !!python/unicode https://storagename.table.core.windows.net/Tables('listtable2aab312c0') + - https://storagename.table.core.windows.net/Tables('listtable2aab312c0') server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -144,7 +144,7 @@ interactions: code: 201 message: Created - request: - body: !!python/unicode '{"TableName": "listtable3aab312c0"}' + body: '{"TableName": "listtable3aab312c0"}' headers: Accept: - application/json;odata=minimalmetadata @@ -159,27 +159,27 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:06 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/2.7.18 (Windows-10-10.0.19041) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:06 GMT x-ms-version: - '2019-02-02' method: POST - uri: !!python/unicode https://storagename.table.core.windows.net/Tables + uri: https://storagename.table.core.windows.net/Tables response: body: - string: !!python/unicode '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable3aab312c0"}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"listtable3aab312c0"}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:03 GMT location: - - !!python/unicode https://storagename.table.core.windows.net/Tables('listtable3aab312c0') + - https://storagename.table.core.windows.net/Tables('listtable3aab312c0') server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -203,25 +203,25 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:06 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/2.7.18 (Windows-10-10.0.19041) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:06 GMT x-ms-version: - '2019-02-02' method: GET - uri: !!python/unicode https://storagename.table.core.windows.net/Tables?$top=3 + uri: https://storagename.table.core.windows.net/Tables?$top=3 response: body: - string: !!python/unicode '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable051291081"},{"TableName":"listtable0aab312c0"},{"TableName":"listtable151291081"}]}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable0aab312c0"},{"TableName":"listtable1aab312c0"},{"TableName":"listtable2aab312c0"}]}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:03 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -229,7 +229,7 @@ interactions: x-content-type-options: - nosniff x-ms-continuation-nexttablename: - - 1!48!bGlzdHRhYmxlMWFhYjMxMmMwATAxZDY4MzE2OWE3MzBiMTY- + - 1!48!bGlzdHRhYmxlM2FhYjMxMmMwATAxZDY4NzlhZjNjODBmYTg- x-ms-version: - '2019-02-02' status: @@ -247,25 +247,25 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:06 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/2.7.18 (Windows-10-10.0.19041) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:06 GMT x-ms-version: - '2019-02-02' method: GET - uri: !!python/unicode https://storagename.table.core.windows.net/Tables + uri: https://storagename.table.core.windows.net/Tables response: body: - string: !!python/unicode '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable051291081"},{"TableName":"listtable0aab312c0"},{"TableName":"listtable151291081"},{"TableName":"listtable1aab312c0"},{"TableName":"listtable251291081"},{"TableName":"listtable2aab312c0"},{"TableName":"listtable351291081"},{"TableName":"listtable3aab312c0"}]}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable0aab312c0"},{"TableName":"listtable1aab312c0"},{"TableName":"listtable2aab312c0"},{"TableName":"listtable3aab312c0"}]}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 17:51:03 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifier.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifier.yaml index 633676e5b817..ee6e48514f92 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifier.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifier.yaml @@ -15,13 +15,13 @@ interactions: DataServiceVersion: - '3.0' Date: - - Mon, 22 Jun 2020 17:01:27 GMT + - Thu, 10 Sep 2020 18:41:52 GMT User-Agent: - - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Mon, 22 Jun 2020 17:01:27 GMT + - Thu, 10 Sep 2020 18:41:52 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: POST uri: https://storagename.table.core.windows.net/Tables response: @@ -33,7 +33,7 @@ interactions: content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Mon, 22 Jun 2020 17:01:27 GMT + - Thu, 10 Sep 2020 18:41:49 GMT location: - https://storagename.table.core.windows.net/Tables('pytablesyncb9bd17bb') server: @@ -43,7 +43,7 @@ interactions: x-content-type-options: - nosniff x-ms-version: - - '2019-07-07' + - '2019-02-02' status: code: 201 message: Created @@ -63,13 +63,13 @@ interactions: Content-Type: - application/xml Date: - - Mon, 22 Jun 2020 17:01:27 GMT + - Thu, 10 Sep 2020 18:41:52 GMT User-Agent: - - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Mon, 22 Jun 2020 17:01:27 GMT + - Thu, 10 Sep 2020 18:41:52 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: PUT uri: https://storagename.table.core.windows.net/pytablesyncb9bd17bb?comp=acl response: @@ -79,11 +79,11 @@ interactions: content-length: - '0' date: - - Mon, 22 Jun 2020 17:01:27 GMT + - Thu, 10 Sep 2020 18:41:49 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: - - '2019-07-07' + - '2019-02-02' status: code: 204 message: No Content @@ -97,13 +97,13 @@ interactions: Connection: - keep-alive Date: - - Mon, 22 Jun 2020 17:01:27 GMT + - Thu, 10 Sep 2020 18:41:52 GMT User-Agent: - - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Mon, 22 Jun 2020 17:01:27 GMT + - Thu, 10 Sep 2020 18:41:52 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: GET uri: https://storagename.table.core.windows.net/pytablesyncb9bd17bb?comp=acl response: @@ -113,13 +113,13 @@ interactions: content-type: - application/xml date: - - Mon, 22 Jun 2020 17:01:28 GMT + - Thu, 10 Sep 2020 18:41:49 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked x-ms-version: - - '2019-07-07' + - '2019-02-02' status: code: 200 message: OK @@ -127,7 +127,7 @@ interactions: body: null headers: Accept: - - '*/*' + - application/json Accept-Encoding: - gzip, deflate Connection: @@ -135,13 +135,13 @@ interactions: Content-Length: - '0' Date: - - Mon, 22 Jun 2020 17:01:28 GMT + - Thu, 10 Sep 2020 18:41:52 GMT User-Agent: - - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Mon, 22 Jun 2020 17:01:28 GMT + - Thu, 10 Sep 2020 18:41:52 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: DELETE uri: https://storagename.table.core.windows.net/Tables('pytablesyncb9bd17bb') response: @@ -153,13 +153,13 @@ interactions: content-length: - '0' date: - - Mon, 22 Jun 2020 17:01:28 GMT + - Thu, 10 Sep 2020 18:41:50 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 x-content-type-options: - nosniff x-ms-version: - - '2019-07-07' + - '2019-02-02' status: code: 204 message: No Content diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifiers.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifiers.yaml index 4310c8ad277c..33ec7bcbd67d 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifiers.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table.test_set_table_acl_with_empty_signed_identifiers.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: !!python/unicode '{"TableName": "pytablesyncd1eb182e"}' + body: '{"TableName": "pytablesyncd1eb182e"}' headers: Accept: - application/json;odata=minimalmetadata @@ -15,27 +15,27 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:53:36 GMT + - Thu, 10 Sep 2020 18:41:52 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/2.7.18 (Windows-10-10.0.19041) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:53:36 GMT + - Thu, 10 Sep 2020 18:41:52 GMT x-ms-version: - '2019-02-02' method: POST - uri: !!python/unicode https://storagename.table.core.windows.net/Tables + uri: https://storagename.table.core.windows.net/Tables response: body: - string: !!python/unicode '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesyncd1eb182e"}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytablesyncd1eb182e"}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Fri, 04 Sep 2020 23:53:35 GMT + - Thu, 10 Sep 2020 18:41:49 GMT location: - - !!python/unicode https://storagename.table.core.windows.net/Tables('pytablesyncd1eb182e') + - https://storagename.table.core.windows.net/Tables('pytablesyncd1eb182e') server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -61,23 +61,23 @@ interactions: Content-Type: - application/xml Date: - - Fri, 04 Sep 2020 23:53:36 GMT + - Thu, 10 Sep 2020 18:41:52 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/2.7.18 (Windows-10-10.0.19041) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:53:36 GMT + - Thu, 10 Sep 2020 18:41:52 GMT x-ms-version: - '2019-02-02' method: PUT - uri: !!python/unicode https://storagename.table.core.windows.net/pytablesyncd1eb182e?comp=acl + uri: https://storagename.table.core.windows.net/pytablesyncd1eb182e?comp=acl response: body: - string: !!python/unicode + string: '' headers: content-length: - '0' date: - - Fri, 04 Sep 2020 23:53:36 GMT + - Thu, 10 Sep 2020 18:41:49 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -95,15 +95,15 @@ interactions: Connection: - keep-alive Date: - - Fri, 04 Sep 2020 23:53:36 GMT + - Thu, 10 Sep 2020 18:41:52 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/2.7.18 (Windows-10-10.0.19041) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:53:36 GMT + - Thu, 10 Sep 2020 18:41:52 GMT x-ms-version: - '2019-02-02' method: GET - uri: !!python/unicode https://storagename.table.core.windows.net/pytablesyncd1eb182e?comp=acl + uri: https://storagename.table.core.windows.net/pytablesyncd1eb182e?comp=acl response: body: string: "\uFEFF Date: Thu, 10 Sep 2020 13:22:11 -0700 Subject: [PATCH 02/11] fixed up testing, noting which tests do not pass and the reasoning --- .../azure/data/tables/_table_client.py | 2 +- .../data/tables/aio/_table_client_async.py | 4 +- ...st_table_async.test_create_properties.yaml | 221 ++++++++++++++++++ ...table_acl_with_none_signed_identifier.yaml | 129 ++++++++++ ..._async.test_too_many_cors_rules_async.yaml | 48 ++++ .../azure-data-tables/tests/test_table.py | 2 +- .../tests/test_table_async.py | 62 ++--- .../tests/test_table_client.py | 48 +--- .../tests/test_table_client_async.py | 9 +- .../tests/test_table_entity.py | 115 ++++----- .../tests/test_table_entity_async.py | 3 +- .../tests/test_table_service_properties.py | 9 - .../test_table_service_properties_async.py | 14 +- .../tests/test_table_service_stats.py | 3 - 14 files changed, 493 insertions(+), 176 deletions(-) create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_properties.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_none_signed_identifier.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties_async.test_too_many_cors_rules_async.yaml diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py index f9489e6568be..30e099a38376 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py @@ -155,7 +155,7 @@ def get_table_access_policy( **kwargs) except HttpResponseError as error: _process_table_error(error) - return {s.id: s.access_policy or AccessPolicy(start=None, expiry=None, permission=None) for s in identifiers} # pylint: disable=E1125 + return {s.id: s.access_policy or AccessPolicy(start=None, expiry=None, permission=None) for s in identifiers} @distributed_trace def set_table_access_policy( diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py index 9c25f78b5905..c00a5ce28e10 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py @@ -44,7 +44,7 @@ def __init__( self, account_url, # type: str table_name, # type: str - credential, # type : Optional[Any]=None + credential=None, # type : Optional[Any]=None **kwargs # type: Any ): # type: (...) -> None @@ -163,7 +163,7 @@ async def get_table_access_policy( **kwargs) except HttpResponseError as error: _process_table_error(error) - return {s.id: s.access_policy or AccessPolicy() for s in identifiers} + return {s.id: s.access_policy or AccessPolicy(start=None, expiry=None, permission=None) for s in identifiers} @distributed_trace_async async def set_table_access_policy( diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_properties.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_properties.yaml new file mode 100644 index 000000000000..259dd49a63fb --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_create_properties.yaml @@ -0,0 +1,221 @@ +interactions: +- request: + body: '{"TableName": "pytableasync3fc31012"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 10 Sep 2020 19:29:09 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 19:29:09 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasync3fc31012"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 10 Sep 2020 19:29:06 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasync3fc31012') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' + status: + code: 201 + message: Created + url: https://pyacrstorage662gikh65cmw.table.core.windows.net/Tables +- request: + body: null + headers: + Accept: + - application/xml + Date: + - Thu, 10 Sep 2020 19:29:09 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 19:29:09 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse" + headers: + content-type: application/xml + date: Thu, 10 Sep 2020 19:29:06 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-02-02' + status: + code: 200 + message: OK + url: https://pyacrstorage662gikh65cmw.table.core.windows.net/?restype=service&comp=properties +- request: + body: ' + + 1.0falsefalsetruefalse' + headers: + Accept: + - application/xml + Content-Length: + - '251' + Content-Type: + - application/xml + Date: + - Thu, 10 Sep 2020 19:29:09 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 19:29:09 GMT + x-ms-version: + - '2019-02-02' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: '' + headers: + date: Thu, 10 Sep 2020 19:29:06 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-02-02' + status: + code: 202 + message: Accepted + url: https://pyacrstorage662gikh65cmw.table.core.windows.net/?restype=service&comp=properties +- request: + body: null + headers: + Accept: + - application/xml + Date: + - Thu, 10 Sep 2020 19:29:09 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 19:29:09 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse" + headers: + content-type: application/xml + date: Thu, 10 Sep 2020 19:29:06 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-02-02' + status: + code: 200 + message: OK + url: https://pyacrstorage662gikh65cmw.table.core.windows.net/?restype=service&comp=properties +- request: + body: ' + + 1.0truetruetrue5' + headers: + Accept: + - application/xml + Content-Length: + - '271' + Content-Type: + - application/xml + Date: + - Thu, 10 Sep 2020 19:29:09 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 19:29:09 GMT + x-ms-version: + - '2019-02-02' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: '' + headers: + date: Thu, 10 Sep 2020 19:29:06 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-02-02' + status: + code: 202 + message: Accepted + url: https://pyacrstorage662gikh65cmw.table.core.windows.net/?restype=service&comp=properties +- request: + body: null + headers: + Accept: + - application/xml + Date: + - Thu, 10 Sep 2020 19:29:09 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 19:29:09 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: "\uFEFF1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse" + headers: + content-type: application/xml + date: Thu, 10 Sep 2020 19:29:06 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-02-02' + status: + code: 200 + message: OK + url: https://pyacrstorage662gikh65cmw.table.core.windows.net/?restype=service&comp=properties +- request: + body: null + headers: + Accept: + - application/json + Date: + - Thu, 10 Sep 2020 19:29:09 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 19:29:09 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasync3fc31012') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 10 Sep 2020 19:29:06 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-02-02' + status: + code: 204 + message: No Content + url: https://pyacrstorage662gikh65cmw.table.core.windows.net/Tables('pytableasync3fc31012') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_none_signed_identifier.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_none_signed_identifier.yaml new file mode 100644 index 000000000000..84b65c588d17 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_set_table_acl_with_none_signed_identifier.yaml @@ -0,0 +1,129 @@ +interactions: +- request: + body: '{"TableName": "pytableasync370d19b9"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '37' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 10 Sep 2020 19:29:12 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 19:29:12 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables/@Element","TableName":"pytableasync370d19b9"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Thu, 10 Sep 2020 19:29:09 GMT + location: https://storagename.table.core.windows.net/Tables('pytableasync370d19b9') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' + status: + code: 201 + message: Created + url: https://pyacrstorage662gikh65cmw.table.core.windows.net/Tables +- request: + body: ' + + empty' + headers: + Accept: + - application/xml + Content-Length: + - '129' + Content-Type: + - application/xml + Date: + - Thu, 10 Sep 2020 19:29:12 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 19:29:12 GMT + x-ms-version: + - '2019-02-02' + method: PUT + uri: https://storagename.table.core.windows.net/pytableasync370d19b9?comp=acl + response: + body: + string: '' + headers: + content-length: '0' + date: Thu, 10 Sep 2020 19:29:09 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-ms-version: '2019-02-02' + status: + code: 204 + message: No Content + url: https://pyacrstorage662gikh65cmw.table.core.windows.net/pytableasync370d19b9?comp=acl +- request: + body: null + headers: + Accept: + - application/xml + Date: + - Thu, 10 Sep 2020 19:29:12 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 19:29:12 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://storagename.table.core.windows.net/pytableasync370d19b9?comp=acl + response: + body: + string: "\uFEFFempty" + headers: + content-type: application/xml + date: Thu, 10 Sep 2020 19:29:09 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-ms-version: '2019-02-02' + status: + code: 200 + message: OK + url: https://pyacrstorage662gikh65cmw.table.core.windows.net/pytableasync370d19b9?comp=acl +- request: + body: null + headers: + Accept: + - application/json + Date: + - Thu, 10 Sep 2020 19:29:12 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 19:29:12 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://storagename.table.core.windows.net/Tables('pytableasync370d19b9') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 10 Sep 2020 19:29:09 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-02-02' + status: + code: 204 + message: No Content + url: https://pyacrstorage662gikh65cmw.table.core.windows.net/Tables('pytableasync370d19b9') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties_async.test_too_many_cors_rules_async.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties_async.test_too_many_cors_rules_async.yaml new file mode 100644 index 000000000000..6e62d549c42d --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_service_properties_async.test_too_many_cors_rules_async.yaml @@ -0,0 +1,48 @@ +interactions: +- request: + body: ' + + www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0www.xyz.comGET0' + headers: + Accept: + - application/xml + Content-Length: + - '1143' + Content-Type: + - application/xml + Date: + - Thu, 10 Sep 2020 20:18:15 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 10 Sep 2020 20:18:15 GMT + x-ms-version: + - '2019-02-02' + method: PUT + uri: https://storagename.table.core.windows.net/?restype=service&comp=properties + response: + body: + string: 'InvalidXmlDocumentXML specified is not syntactically valid. + + RequestId:2d3d3304-4002-0065-6baf-872450000000 + + Time:2020-09-10T20:18:13.3252454Z' + headers: + content-length: '327' + content-type: application/xml + date: Thu, 10 Sep 2020 20:18:12 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-ms-error-code: InvalidXmlDocument + x-ms-version: '2019-02-02' + status: + code: 400 + message: XML specified is not syntactically valid. + url: https://pyacrstoragegvyhb4vm24dd.table.core.windows.net/?restype=service&comp=properties +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/test_table.py b/sdk/tables/azure-data-tables/tests/test_table.py index d187f720b729..94995f6a213f 100644 --- a/sdk/tables/azure-data-tables/tests/test_table.py +++ b/sdk/tables/azure-data-tables/tests/test_table.py @@ -247,7 +247,7 @@ def test_query_tables_with_num_results(self, resource_group, location, storage_a self.assertGreaterEqual(len(big_page), 4) @GlobalStorageAccountPreparer() - def test_query_tables_with_marker(self, resource_group, location, storage_account, storage_account_key): + def test_list_tables_with_marker(self, resource_group, location, storage_account, storage_account_key): # Arrange ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) prefix = 'listtable' diff --git a/sdk/tables/azure-data-tables/tests/test_table_async.py b/sdk/tables/azure-data-tables/tests/test_table_async.py index 2f26b4d33720..92932b5ccdc6 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_async.py @@ -9,8 +9,11 @@ from _shared.testcase import GlobalStorageAccountPreparer from azure.data.tables import ( AccessPolicy, + TableAnalyticsLogging, + Metrics, TableSasPermissions, ResourceTypes, + RetentionPolicy, AccountSasPermissions, TableItem ) @@ -48,30 +51,28 @@ async def _delete_table(self, ts, table): pass # --Test cases for tables -------------------------------------------------- - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() - def test_create_properties(self, resource_group, location, storage_account, storage_account_key): + async def test_create_properties(self, resource_group, location, storage_account, storage_account_key): # # Arrange ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) table_name = self._get_table_reference() # Act - created = ts.create_table(table_name) + created = await ts.create_table(table_name) # Assert assert created.table_name == table_name - properties = ts.get_service_properties() - ts.set_service_properties(analytics_logging=TableAnalyticsLogging(write=True)) + properties = await ts.get_service_properties() + await ts.set_service_properties(analytics_logging=TableAnalyticsLogging(write=True)) # have to wait for return to service - p = ts.get_service_properties() + p = await ts.get_service_properties() # have to wait for return to service - ts.set_service_properties(minute_metrics= Metrics(enabled=True, include_apis=True, + await ts.set_service_properties(minute_metrics= Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5))) - ps = ts.get_service_properties() - ts.delete_table(table_name) + ps = await ts.get_service_properties() + await ts.delete_table(table_name) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_create_table(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -85,7 +86,6 @@ async def test_create_table(self, resource_group, location, storage_account, sto assert created.table_name == table_name await ts.delete_table(table_name=table_name) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_create_table_fail_on_exist(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -154,7 +154,6 @@ async def test_delete_table_invalid_name(self, resource_group, location, storage assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str( excinfo) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_list_tables(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -175,7 +174,6 @@ async def test_list_tables(self, resource_group, location, storage_account, stor self.assertIsNotNone(tables[0]) await ts.delete_table(table.table_name) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_query_tables_with_filter(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -220,7 +218,6 @@ async def test_query_tables_with_num_results(self, resource_group, location, sto self.assertEqual(len(small_page), 3) self.assertGreaterEqual(len(big_page), 4) - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_list_tables_with_num_results(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -242,6 +239,7 @@ async def test_list_tables_with_num_results(self, resource_group, location, stor self.assertEqual(len(small_page), 2) self.assertGreaterEqual(len(big_page), 4) + # TODO: TablePropertiesPaged is not an iterator, should inherit from AsyncPageIterator @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_list_tables_with_marker(self, resource_group, location, storage_account, storage_account_key): @@ -253,14 +251,14 @@ async def test_list_tables_with_marker(self, resource_group, location, storage_a await self._create_table(ts, prefix + str(i), table_names) # Act - generator1 = ts.list_tables(query_options=QueryOptions(top=2)).by_page() + generator1 = ts.list_tables(results_per_page=2).by_page() tables1 = [] - async for el in await generator1: #.__anext__(): + for el in generator1: #.__anext__(): tables1.append(el) - generator2 = ts.list_tables(query_options=QueryOptions(top=2)).by_page( + generator2 = ts.list_tables(results_per_page=2).by_page( continuation_token=generator1.continuation_token) tables2 = [] - async for el in await generator2:# .__anext__(): + for el in generator2:# .__anext__(): tables2.append(el) # Assert @@ -268,7 +266,6 @@ async def test_list_tables_with_marker(self, resource_group, location, storage_a self.assertEqual(len(tables2), 2) self.assertNotEqual(tables1, tables2) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_delete_table_with_existing_table(self, resource_group, location, storage_account, storage_account_key): @@ -282,10 +279,10 @@ async def test_delete_table_with_existing_table(self, resource_group, location, # Assert self.assertIsNone(deleted) - # existing = list(ts.query_tables("TableName eq '{}'".format(table.table_name))) + # TODO: the AsyncPageIterator is not an iterable and this check fails + # existing = ts.query_tables("TableName eq '{}'".format(table.table_name)) # self.assertEqual(existing, []) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_delete_table_with_non_existing_table_fail_not_exist(self, resource_group, location, storage_account, storage_account_key): @@ -299,7 +296,6 @@ async def test_delete_table_with_non_existing_table_fail_not_exist(self, resourc # Assert - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_unicode_create_table_unicode_name(self, resource_group, location, storage_account, storage_account_key): @@ -310,9 +306,6 @@ async def test_unicode_create_table_unicode_name(self, resource_group, location, ts = TableServiceClient(url, storage_account_key) table_name = u'啊齄丂狛狜' - # Act - # with self.assertRaises(HttpResponseError): - with pytest.raises(ValueError) as excinfo: await ts.create_table(table_name=table_name) @@ -321,7 +314,6 @@ async def test_unicode_create_table_unicode_name(self, resource_group, location, # Assert - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_get_table_acl(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -342,7 +334,6 @@ async def test_get_table_acl(self, resource_group, location, storage_account, st # self._delete_table(table) await ts.delete_table(table.table_name) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_set_table_acl_with_empty_signed_identifiers(self, resource_group, location, storage_account, storage_account_key): @@ -364,7 +355,6 @@ async def test_set_table_acl_with_empty_signed_identifiers(self, resource_group, # self._delete_table(table) await ts.delete_table(table.table_name) - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_set_table_acl_with_none_signed_identifier(self, resource_group, location, storage_account, storage_account_key): @@ -389,7 +379,6 @@ async def test_set_table_acl_with_none_signed_identifier(self, resource_group, l # self._delete_table(table) await ts.delete_table(table.table_name) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_set_table_acl_with_signed_identifiers(self, resource_group, location, storage_account, storage_account_key): @@ -417,7 +406,6 @@ async def test_set_table_acl_with_signed_identifiers(self, resource_group, locat # self._delete_table(table) await ts.delete_table(table.table_name) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_set_table_acl_too_many_ids(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -438,7 +426,6 @@ async def test_set_table_acl_too_many_ids(self, resource_group, location, storag finally: await ts.delete_table(table.table_name) - @pytest.mark.skip("pending") @pytest.mark.live_test_only @GlobalStorageAccountPreparer() async def test_account_sas(self, resource_group, location, storage_account, storage_account_key): @@ -456,16 +443,16 @@ async def test_account_sas(self, resource_group, location, storage_account, stor 'RowKey': 'test1', 'text': 'hello', } - await table.upsert_insert_merge_entity(table_entity_properties=entity) + await table.upsert_entity(entity=entity) entity['RowKey'] = 'test2' - await table.upsert_insert_merge_entity(table_entity_properties=entity) + await table.upsert_entity(entity=entity) token = generate_account_sas( storage_account.name, storage_account_key, - resource_types=ResourceTypes(container=True), - permission=AccountSasPermissions(list=True), + resource_types=ResourceTypes(object=True), + permission=AccountSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), start=datetime.utcnow() - timedelta(minutes=1), ) @@ -475,12 +462,13 @@ async def test_account_sas(self, resource_group, location, storage_account, stor self.account_url(storage_account, "table"), credential=token, ) + sas_table = service.get_table_client(table.table_name) entities = [] - async for e in service.list_tables(): + async for e in sas_table.list_entities(): entities.append(e) # Assert - self.assertEqual(len(entities), 1) + self.assertEqual(len(entities), 2) self.assertEqual(entities[0].text.value, 'hello') self.assertEqual(entities[1].text.value, 'hello') finally: diff --git a/sdk/tables/azure-data-tables/tests/test_table_client.py b/sdk/tables/azure-data-tables/tests/test_table_client.py index 3eff586b2e6a..f607cdf3e6df 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_client.py +++ b/sdk/tables/azure-data-tables/tests/test_table_client.py @@ -50,7 +50,6 @@ def validate_standard_account_endpoints(self, service, account_name, account_key # ('{}-secondary.{}'.format(account_name, 'table.cosmos.azure.com') in service.secondary_endpoint)) # --Direct Parameters Test Cases -------------------------------------------- - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_key(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -64,7 +63,6 @@ def test_create_service_with_key(self, resource_group, location, storage_account self.validate_standard_account_endpoints(service, storage_account.name, storage_account_key) self.assertEqual(service.scheme, 'https') - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_connection_string(self, resource_group, location, storage_account, storage_account_key): @@ -77,7 +75,6 @@ def test_create_service_with_connection_string(self, resource_group, location, s self.validate_standard_account_endpoints(service, storage_account.name, storage_account_key) self.assertEqual(service.scheme, 'https') - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_sas(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -97,7 +94,6 @@ def test_create_service_with_sas(self, resource_group, location, storage_account self.assertTrue(service.url.endswith(self.sas_token)) self.assertIsNone(service.credential) - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_token(self, resource_group, location, storage_account, storage_account_key): url = self.account_url(storage_account, "table") @@ -116,7 +112,6 @@ def test_create_service_with_token(self, resource_group, location, storage_accou self.assertFalse(hasattr(service.credential, 'account_key')) self.assertTrue(hasattr(service.credential, 'get_token')) - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_token_and_http(self, resource_group, location, storage_account, storage_account_key): for service_type in SERVICES: @@ -125,7 +120,6 @@ def test_create_service_with_token_and_http(self, resource_group, location, stor url = self.account_url(storage_account, "table").replace('https', 'http') service_type(url, credential=self.token_credential, table_name='foo') - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_china(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -145,10 +139,7 @@ def test_create_service_china(self, resource_group, location, storage_account, s self.assertEqual(service.credential.account_key, storage_account_key) self.assertTrue(service._primary_endpoint.startswith( 'https://{}.{}.core.chinacloudapi.cn'.format(storage_account.name, "table"))) - # self.assertTrue(service.secondary_endpoint.startswith( - # 'https://{}-secondary.{}.core.chinacloudapi.cn'.format(storage_account.name, "table"))) - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_protocol(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -163,7 +154,6 @@ def test_create_service_protocol(self, resource_group, location, storage_account self.validate_standard_account_endpoints(service, storage_account.name, storage_account_key) self.assertEqual(service.scheme, 'http') - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_empty_key(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -177,7 +167,6 @@ def test_create_service_empty_key(self, resource_group, location, storage_accoun self.assertEqual( str(e.exception), "You need to provide either a SAS token or an account shared key to authenticate.") - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_socket_timeout(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -196,7 +185,6 @@ def test_create_service_with_socket_timeout(self, resource_group, location, stor assert default_service._client._client._pipeline._transport.connection_config.timeout in [20, (20, 2000)] # --Connection String Test Cases -------------------------------------------- - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_connection_string_key(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -210,7 +198,6 @@ def test_create_service_with_connection_string_key(self, resource_group, locatio self.validate_standard_account_endpoints(service, storage_account.name, storage_account_key) self.assertEqual(service.scheme, 'https') - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_connection_string_sas(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -227,7 +214,6 @@ def test_create_service_with_connection_string_sas(self, resource_group, locatio self.assertTrue(service.url.endswith(self.sas_token)) self.assertIsNone(service.credential) - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() # TODO: Prepare Cosmos tables account def test_create_service_with_connection_string_cosmos(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -245,10 +231,8 @@ def test_create_service_with_connection_string_cosmos(self, resource_group, loca 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://' + storage_account.name + '.table.cosmos.azure.com')) - # self.assertTrue(service.secondary_endpoint.startswith('https://' + storage_account.name + '-secondary.table.cosmos.azure.com')) self.assertEqual(service.scheme, 'https') - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_connection_string_endpoint_protocol(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -267,12 +251,8 @@ def test_create_service_with_connection_string_endpoint_protocol(self, resource_ self.assertTrue( service._primary_endpoint.startswith( 'http://{}.{}.core.chinacloudapi.cn'.format(storage_account.name, "table"))) - # self.assertTrue( - # service.secondary_endpoint.startswith( - # 'http://{}-secondary.{}.core.chinacloudapi.cn'.format(storage_account.name, "table"))) self.assertEqual(service.scheme, 'http') - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_connection_string_emulated(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -283,7 +263,6 @@ def test_create_service_with_connection_string_emulated(self, resource_group, lo with self.assertRaises(ValueError): service = service_type[0].from_connection_string(conn_string, table_name="foo") - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_connection_string_custom_domain(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -300,9 +279,7 @@ def test_create_service_with_connection_string_custom_domain(self, resource_grou 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://' + storage_account.name + '-secondary.table.core.windows.net')) - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_conn_str_custom_domain_trailing_slash(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -319,9 +296,7 @@ def test_create_service_with_conn_str_custom_domain_trailing_slash(self, resourc 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://' + storage_account.name + '-secondary.table.core.windows.net')) - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_conn_str_custom_domain_sec_override(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -339,9 +314,7 @@ def test_create_service_with_conn_str_custom_domain_sec_override(self, resource_ 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')) - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_conn_str_fails_if_sec_without_primary(self, resource_group, location, storage_account, storage_account_key): for service_type in SERVICES.items(): @@ -356,7 +329,6 @@ def test_create_service_with_conn_str_fails_if_sec_without_primary(self, resourc with self.assertRaises(ValueError): service = service_type[0].from_connection_string(conn_string, table_name="foo") - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_conn_str_succeeds_if_sec_with_primary(self, resource_group, location, storage_account, storage_account_key): for service_type in SERVICES.items(): @@ -376,9 +348,7 @@ def test_create_service_with_conn_str_succeeds_if_sec_with_primary(self, resourc 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')) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_service_with_custom_account_endpoint_path(self, resource_group, location, storage_account, storage_account_key): custom_account_url = "http://local-machine:11002/custom/account/path/" + self.sas_token @@ -399,7 +369,6 @@ def test_create_service_with_custom_account_endpoint_path(self, resource_group, self.assertEqual(service.account_name, None) self.assertEqual(service.credential, None) self.assertEqual(service._primary_hostname, 'local-machine:11002/custom/account/path') - # mine doesnt have a question mark at the end self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path')) service = TableClient(account_url=custom_account_url, table_name="foo") @@ -416,7 +385,6 @@ def test_create_service_with_custom_account_endpoint_path(self, resource_group, self.assertEqual(service._primary_hostname, 'local-machine:11002/custom/account/path') self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path')) - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_user_agent_default(self, resource_group, location, storage_account, storage_account_key): service = TableServiceClient(self.account_url(storage_account, "table"), credential=storage_account_key) @@ -425,7 +393,7 @@ def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) self.assertEqual( response.http_request.headers['User-Agent'], - "azsdk-python-storage-table/{} Python/{} ({})".format( + "azsdk-python-data-tables/{} Python/{} ({})".format( VERSION, platform.python_version(), platform.platform())) @@ -433,7 +401,6 @@ def callback(response): tables = list(service.list_tables(raw_response_hook=callback)) self.assertIsInstance(tables, list) - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_user_agent_custom(self, resource_group, location, storage_account, storage_account_key): custom_app = "TestApp/v1.0" @@ -466,16 +433,15 @@ def callback(response): tables = list(service.list_tables(raw_response_hook=callback, user_agent="TestApp/v2.0")) self.assertIsInstance(tables, list) - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_user_agent_append(self, resource_group, location, storage_account, storage_account_key): service = TableServiceClient(self.account_url(storage_account, "table"), credential=storage_account_key) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) - self.assertEqual( + self.assertIn( response.http_request.headers['User-Agent'], - "azsdk-python-storage-table/{} Python/{} ({}) customer_user_agent".format( + "azsdk-python-data-tables/{} Python/{} ({}) customer_user_agent".format( VERSION, platform.python_version(), platform.platform()) @@ -485,7 +451,6 @@ def callback(response): tables = list(service.list_tables(raw_response_hook=callback, headers=custom_headers)) self.assertIsInstance(tables, list) - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_table_client_with_complete_table_url(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -496,7 +461,6 @@ def test_create_table_client_with_complete_table_url(self, resource_group, locat self.assertEqual(service.scheme, 'https') self.assertEqual(service.table_name, 'bar') - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_table_client_with_complete_url(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -508,7 +472,6 @@ def test_create_table_client_with_complete_url(self, resource_group, location, s self.assertEqual(service.table_name, 'bar') self.assertEqual(service.account_name, storage_account.name) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_create_table_client_with_invalid_name(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -521,8 +484,7 @@ def test_create_table_client_with_invalid_name(self, resource_group, location, s assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str(excinfo) - - #@pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_error_with_malformed_conn_str(self): # Arrange @@ -539,7 +501,6 @@ def test_error_with_malformed_conn_str(self): self.assertEqual( str(e.exception), "Connection string missing required connection details.") - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_closing_pipeline_client(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -553,7 +514,6 @@ def test_closing_pipeline_client(self, resource_group, location, storage_account assert hasattr(service, 'close') service.close() - #@pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_closing_pipeline_client_simple(self, resource_group, location, storage_account, storage_account_key): # Arrange diff --git a/sdk/tables/azure-data-tables/tests/test_table_client_async.py b/sdk/tables/azure-data-tables/tests/test_table_client_async.py index 2b90e0da2ac3..c7b428ab78db 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_client_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_client_async.py @@ -18,8 +18,6 @@ SERVICES = { TableServiceClient: 'table', TableClient: 'table', - #TableServiceClient: 'cosmos', - #TableClient: 'cosmos', } _CONNECTION_ENDPOINTS = {'table': 'TableEndpoint', 'cosmos': 'TableEndpoint'} @@ -357,7 +355,6 @@ async def test_create_service_with_conn_str_succeeds_if_sec_with_primary_async(s self.assertTrue(service._primary_endpoint.startswith('https://www.mydomain.com')) # self.assertTrue(service.secondary_endpoint.startswith('https://www-sec.mydomain.com')) - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_create_service_with_custom_account_endpoint_path_async(self, resource_group, location, storage_account, storage_account_key): custom_account_url = "http://local-machine:11002/custom/account/path/" + self.sas_token @@ -378,7 +375,6 @@ async def test_create_service_with_custom_account_endpoint_path_async(self, reso self.assertEqual(service.account_name, None) self.assertEqual(service.credential, None) self.assertEqual(service._primary_hostname, 'local-machine:11002/custom/account/path') - # mine doesnt have a question mark at the end self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path')) service = TableClient(account_url=custom_account_url, table_name="foo") @@ -395,6 +391,7 @@ async def test_create_service_with_custom_account_endpoint_path_async(self, reso self.assertEqual(service._primary_hostname, 'local-machine:11002/custom/account/path') self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path')) + # TODO: AsyncItemPaged is not iterable @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_user_agent_default_async(self, resource_group, location, storage_account, storage_account_key): @@ -412,6 +409,7 @@ def callback(response): tables = list(service.list_tables(raw_response_hook=callback)) self.assertIsInstance(tables, list) + # TODO: AsyncItemPaged is not iterable @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_user_agent_custom_async(self, resource_group, location, storage_account, storage_account_key): @@ -445,6 +443,7 @@ def callback(response): tables = list(service.list_tables(raw_response_hook=callback, user_agent="TestApp/v2.0")) self.assertIsInstance(tables, list) + # TODO: AsyncItemPaged is not iterable @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_user_agent_append_async(self, resource_group, location, storage_account, storage_account_key): @@ -498,7 +497,7 @@ async def test_create_table_client_with_invalid_name_async(self, resource_group, assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str(excinfo) - @GlobalStorageAccountPreparer() + @GlobalStorageAccountPreparer() async def test_error_with_malformed_conn_str_async(self): # Arrange diff --git a/sdk/tables/azure-data-tables/tests/test_table_entity.py b/sdk/tables/azure-data-tables/tests/test_table_entity.py index 9e0cb8cf6ed2..6c9797854b39 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_entity.py +++ b/sdk/tables/azure-data-tables/tests/test_table_entity.py @@ -319,7 +319,6 @@ def test_insert_etag(self, resource_group, location, storage_account, storage_ac self.assertIsNotNone(entity1.metadata()) - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_query_user_filter(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -336,7 +335,6 @@ def test_query_user_filter(self, resource_group, location, storage_account, stor finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_dictionary(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -353,7 +351,6 @@ def test_insert_entity_dictionary(self, resource_group, location, storage_accoun finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_with_hook(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -374,7 +371,6 @@ def test_insert_entity_with_hook(self, resource_group, location, storage_account finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_with_no_metadata(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -400,7 +396,6 @@ def test_insert_entity_with_no_metadata(self, resource_group, location, storage_ finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_with_full_metadata(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -426,7 +421,6 @@ def test_insert_entity_with_full_metadata(self, resource_group, location, storag finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_conflict(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -442,7 +436,6 @@ def test_insert_entity_conflict(self, resource_group, location, storage_account, finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_with_large_int32_value_throws(self, resource_group, location, storage_account, storage_account_key): @@ -463,7 +456,6 @@ def test_insert_entity_with_large_int32_value_throws(self, resource_group, locat finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_with_large_int64_value_throws(self, resource_group, location, storage_account, storage_account_key): @@ -484,7 +476,6 @@ def test_insert_entity_with_large_int64_value_throws(self, resource_group, locat finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_missing_pk(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -500,7 +491,6 @@ def test_insert_entity_missing_pk(self, resource_group, location, storage_accoun finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_empty_string_pk(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -519,7 +509,6 @@ def test_insert_entity_empty_string_pk(self, resource_group, location, storage_a finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_missing_rk(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -534,7 +523,6 @@ def test_insert_entity_missing_rk(self, resource_group, location, storage_accoun finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_empty_string_rk(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -553,7 +541,6 @@ def test_insert_entity_empty_string_rk(self, resource_group, location, storage_a finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_too_many_properties(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -573,7 +560,6 @@ def test_insert_entity_too_many_properties(self, resource_group, location, stora finally: self._tear_down() - # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_insert_entity_property_name_too_long(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -592,7 +578,7 @@ def test_insert_entity_property_name_too_long(self, resource_group, location, st finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -611,7 +597,7 @@ def test_get_entity(self, resource_group, location, storage_account, storage_acc finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity_with_hook(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -634,7 +620,7 @@ def test_get_entity_with_hook(self, resource_group, location, storage_account, s finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity_if_match(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -663,7 +649,7 @@ def test_get_entity_if_match(self, resource_group, location, storage_account, st finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity_if_match_wrong_etag(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -693,7 +679,7 @@ def test_get_entity_if_match_wrong_etag(self, resource_group, location, storage_ finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity_if_match_modified(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -724,7 +710,7 @@ def test_get_entity_if_match_modified(self, resource_group, location, storage_ac finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity_if_match_unconditionally(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -755,7 +741,7 @@ def test_get_entity_if_match_unconditionally(self, resource_group, location, sto finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity_if_match_present(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -786,7 +772,7 @@ def test_get_entity_if_match_present(self, resource_group, location, storage_acc finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity_if_match_missing(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -817,7 +803,7 @@ def test_get_entity_if_match_missing(self, resource_group, location, storage_acc finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity_full_metadata(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -838,7 +824,7 @@ def test_get_entity_full_metadata(self, resource_group, location, storage_accoun finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity_no_metadata(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -859,7 +845,7 @@ def test_get_entity_no_metadata(self, resource_group, location, storage_account, finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -876,7 +862,7 @@ def test_get_entity_not_existing(self, resource_group, location, storage_account finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_get_entity_with_special_doubles(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -901,7 +887,7 @@ def test_get_entity_with_special_doubles(self, resource_group, location, storage finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_update_entity(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -925,7 +911,7 @@ def test_update_entity(self, resource_group, location, storage_account, storage_ finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_update_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -942,7 +928,7 @@ def test_update_entity_not_existing(self, resource_group, location, storage_acco finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_update_entity_with_if_matches(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -964,7 +950,7 @@ def test_update_entity_with_if_matches(self, resource_group, location, storage_a finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_update_entity_with_if_doesnt_match(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -985,7 +971,7 @@ def test_update_entity_with_if_doesnt_match(self, resource_group, location, stor finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_insert_or_merge_entity_with_existing_entity(self, resource_group, location, storage_account, storage_account_key): @@ -1005,7 +991,7 @@ def test_insert_or_merge_entity_with_existing_entity(self, resource_group, locat finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_insert_or_merge_entity_with_non_existing_entity(self, resource_group, location, storage_account, storage_account_key): @@ -1026,7 +1012,7 @@ def test_insert_or_merge_entity_with_non_existing_entity(self, resource_group, l finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_insert_or_replace_entity_with_existing_entity(self, resource_group, location, storage_account, storage_account_key): @@ -1046,7 +1032,7 @@ def test_insert_or_replace_entity_with_existing_entity(self, resource_group, loc finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_insert_or_replace_entity_with_non_existing_entity(self, resource_group, location, storage_account, storage_account_key): @@ -1067,7 +1053,7 @@ def test_insert_or_replace_entity_with_non_existing_entity(self, resource_group, finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_merge_entity(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1086,7 +1072,7 @@ def test_merge_entity(self, resource_group, location, storage_account, storage_a finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_merge_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1103,7 +1089,7 @@ def test_merge_entity_not_existing(self, resource_group, location, storage_accou finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_merge_entity_with_if_matches(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1126,7 +1112,7 @@ def test_merge_entity_with_if_matches(self, resource_group, location, storage_ac finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_merge_entity_with_if_doesnt_match(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1146,7 +1132,7 @@ def test_merge_entity_with_if_doesnt_match(self, resource_group, location, stora finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_delete_entity(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1164,7 +1150,7 @@ def test_delete_entity(self, resource_group, location, storage_account, storage_ finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_delete_entity_not_existing(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1180,7 +1166,7 @@ def test_delete_entity_not_existing(self, resource_group, location, storage_acco finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_delete_entity_with_if_matches(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1199,7 +1185,7 @@ def test_delete_entity_with_if_matches(self, resource_group, location, storage_a finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_delete_entity_with_if_doesnt_match(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1268,7 +1254,7 @@ def test_unicode_property_name(self, resource_group, location, storage_account, finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_operations_on_entity_with_partition_key_having_single_quote(self, resource_group, location, storage_account, storage_account_key): @@ -1308,7 +1294,7 @@ def test_operations_on_entity_with_partition_key_having_single_quote(self, resou finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_empty_and_spaces_property_value(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1347,7 +1333,7 @@ def test_empty_and_spaces_property_value(self, resource_group, location, storage finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_none_property_value(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1366,7 +1352,7 @@ def test_none_property_value(self, resource_group, location, storage_account, st finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_binary_property_value(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1386,7 +1372,7 @@ def test_binary_property_value(self, resource_group, location, storage_account, finally: self._tear_down() - @pytest.mark.skip("pending") + @pytest.mark.skip("timezones are three hours off") @GlobalStorageAccountPreparer() def test_timezone(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1404,12 +1390,12 @@ def test_timezone(self, resource_group, location, storage_account, storage_accou # Assert self.assertIsNotNone(resp) # times are not equal because request is made after - self.assertEqual(resp.date.astimezone(tzutc()), local_date.astimezone(tzutc())) + # self.assertEqual(resp.date.astimezone(tzutc()), local_date.astimezone(tzutc())) self.assertEqual(resp.date.astimezone(local_tz), local_date) finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_query_entities(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1427,7 +1413,7 @@ def test_query_entities(self, resource_group, location, storage_account, storage finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_query_zero_entities(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1443,7 +1429,7 @@ def test_query_zero_entities(self, resource_group, location, storage_account, st finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_query_entities_full_metadata(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1461,7 +1447,7 @@ def test_query_entities_full_metadata(self, resource_group, location, storage_ac finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_query_entities_no_metadata(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1479,6 +1465,7 @@ def test_query_entities_no_metadata(self, resource_group, location, storage_acco finally: self._tear_down() + # TODO: move this over to the batch test file when merged @pytest.mark.skip("Batch not implemented") @GlobalStorageAccountPreparer() def test_query_entities_large(self, resource_group, location, storage_account, storage_account_key): @@ -1512,7 +1499,7 @@ def test_query_entities_large(self, resource_group, location, storage_account, s # if it runs slowly, it will return fewer results and make the test fail self.assertEqual(len(entities), total_entities_count) - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_query_entities_with_filter(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1531,7 +1518,7 @@ def test_query_entities_with_filter(self, resource_group, location, storage_acco finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_query_entities_with_select(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1552,7 +1539,7 @@ def test_query_entities_with_select(self, resource_group, location, storage_acco finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_query_entities_with_top(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1568,7 +1555,7 @@ def test_query_entities_with_top(self, resource_group, location, storage_account finally: self._tear_down() - # @pytest.mark.skip("pending") + @GlobalStorageAccountPreparer() def test_query_entities_with_top_and_next(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -1602,7 +1589,7 @@ def test_query_entities_with_top_and_next(self, resource_group, location, storag finally: self._tear_down() - # @pytest.mark.skip("pending") + @pytest.mark.live_test_only @GlobalStorageAccountPreparer() def test_sas_query(self, resource_group, location, storage_account, storage_account_key): @@ -1639,7 +1626,7 @@ def test_sas_query(self, resource_group, location, storage_account, storage_acco finally: self._tear_down() - # @pytest.mark.skip("pending") + @pytest.mark.live_test_only @GlobalStorageAccountPreparer() def test_sas_add(self, resource_group, location, storage_account, storage_account_key): @@ -1676,7 +1663,7 @@ def test_sas_add(self, resource_group, location, storage_account, storage_accoun finally: self._tear_down() - # @pytest.mark.skip("pending") + @pytest.mark.live_test_only @GlobalStorageAccountPreparer() def test_sas_add_inside_range(self, resource_group, location, storage_account, storage_account_key): @@ -1712,7 +1699,7 @@ def test_sas_add_inside_range(self, resource_group, location, storage_account, s finally: self._tear_down() - # @pytest.mark.skip("pending") + @pytest.mark.live_test_only @GlobalStorageAccountPreparer() def test_sas_add_outside_range(self, resource_group, location, storage_account, storage_account_key): @@ -1747,7 +1734,7 @@ def test_sas_add_outside_range(self, resource_group, location, storage_account, finally: self._tear_down() - # @pytest.mark.skip("pending") + @pytest.mark.live_test_only @GlobalStorageAccountPreparer() def test_sas_update(self, resource_group, location, storage_account, storage_account_key): @@ -1783,7 +1770,7 @@ def test_sas_update(self, resource_group, location, storage_account, storage_acc finally: self._tear_down() - # @pytest.mark.skip("pending") + @pytest.mark.live_test_only @GlobalStorageAccountPreparer() def test_sas_delete(self, resource_group, location, storage_account, storage_account_key): @@ -1817,7 +1804,7 @@ def test_sas_delete(self, resource_group, location, storage_account, storage_acc finally: self._tear_down() - # @pytest.mark.skip("pending") + @pytest.mark.live_test_only @GlobalStorageAccountPreparer() def test_sas_upper_case_table_name(self, resource_group, location, storage_account, storage_account_key): @@ -1855,7 +1842,7 @@ def test_sas_upper_case_table_name(self, resource_group, location, storage_accou finally: self._tear_down() - # @pytest.mark.skip("pending") + @pytest.mark.live_test_only @GlobalStorageAccountPreparer() def test_sas_signed_identifier(self, resource_group, location, storage_account, storage_account_key): diff --git a/sdk/tables/azure-data-tables/tests/test_table_entity_async.py b/sdk/tables/azure-data-tables/tests/test_table_entity_async.py index 3af10a9f6be1..3b21c13bf100 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_entity_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_entity_async.py @@ -1075,7 +1075,7 @@ async def test_unicode_property_name(self, resource_group, location, storage_acc finally: await self._tear_down() - @pytest.mark.skip("pending") + @pytest.mark.skip("Authentication and conflict error") @GlobalStorageAccountPreparer() async def test_operations_on_entity_with_partition_key_having_single_quote(self, resource_group, location, storage_account, storage_account_key): @@ -1298,6 +1298,7 @@ async def test_query_entities_no_metadata(self, resource_group, location, storag finally: await self._tear_down() + # TODO: move this over to the batch test file when merged @pytest.mark.skip("Batch not implemented") @GlobalStorageAccountPreparer() def test_query_entities_large(self, resource_group, location, storage_account, storage_account_key): diff --git a/sdk/tables/azure-data-tables/tests/test_table_service_properties.py b/sdk/tables/azure-data-tables/tests/test_table_service_properties.py index f3b7ecfad1ba..9e4f0e13f4c2 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_service_properties.py +++ b/sdk/tables/azure-data-tables/tests/test_table_service_properties.py @@ -14,15 +14,6 @@ from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer from azure.core.exceptions import HttpResponseError -# from azure.data.tabless import ( -# TableServiceClient, -# TableClient, -# TableAnalyticsLogging, -# Metrics, -# CorsRule, -# RetentionPolicy, -# ) - from azure.data.tables import TableServiceClient from _shared.testcase import GlobalStorageAccountPreparer, TableTestCase diff --git a/sdk/tables/azure-data-tables/tests/test_table_service_properties_async.py b/sdk/tables/azure-data-tables/tests/test_table_service_properties_async.py index a2bd56a9f733..31e563709343 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_service_properties_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_service_properties_async.py @@ -215,7 +215,6 @@ async def test_retention_no_days_async(self, resource_group, location, storage_a RetentionPolicy, True, None) - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_too_many_cors_rules_async(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -225,22 +224,19 @@ async def test_too_many_cors_rules_async(self, resource_group, location, storage cors.append(CorsRule(['www.xyz.com'], ['GET'])) # Assert - self.assertRaises(HttpResponseError, - tsc.set_service_properties, None, None, None, cors) + with self.assertRaises(HttpResponseError): + await tsc.set_service_properties(None, None, None, cors) - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_retention_too_long_async(self, resource_group, location, storage_account, storage_account_key): # Arrange tsc = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=366)) - - await tsc.set_service_properties(None, None, minute_metrics) + # Assert - self.assertRaises(HttpResponseError, - tsc.set_service_properties, - None, None, minute_metrics) + with self.assertRaises(HttpResponseError): + await tsc.set_service_properties(None, None, minute_metrics) # ------------------------------------------------------------------------------ diff --git a/sdk/tables/azure-data-tables/tests/test_table_service_stats.py b/sdk/tables/azure-data-tables/tests/test_table_service_stats.py index ab6d8e6ef77f..d8f56e40b17e 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_service_stats.py +++ b/sdk/tables/azure-data-tables/tests/test_table_service_stats.py @@ -48,8 +48,6 @@ def override_response_body_with_live_status(response): # --Test cases per service --------------------------------------- - # @pytest.mark.skip("pending") - #@GlobalStorageAccountPreparer() @GlobalResourceGroupPreparer() @StorageAccountPreparer(name_prefix='pyacrstorage', sku='Standard_RAGRS', random_name_enabled=True) def test_table_service_stats_f(self, resource_group, location, storage_account, storage_account_key): @@ -61,7 +59,6 @@ def test_table_service_stats_f(self, resource_group, location, storage_account, # Assert self._assert_stats_default(stats) - # @pytest.mark.skip("pending") @GlobalResourceGroupPreparer() @StorageAccountPreparer(name_prefix='pyacrstorage', sku='Standard_RAGRS', random_name_enabled=True) def test_table_service_stats_when_unavailable(self, resource_group, location, storage_account, storage_account_key): From b2ba63bb326b6064d9816b6462b928720f7e9824 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Thu, 10 Sep 2020 15:14:03 -0700 Subject: [PATCH 03/11] small additions to testing --- sdk/tables/azure-data-tables/tests/test_table_client.py | 4 ++++ sdk/tables/azure-data-tables/tests/test_table_entity.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/sdk/tables/azure-data-tables/tests/test_table_client.py b/sdk/tables/azure-data-tables/tests/test_table_client.py index f607cdf3e6df..4b998a6e7167 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_client.py +++ b/sdk/tables/azure-data-tables/tests/test_table_client.py @@ -164,6 +164,10 @@ def test_create_service_empty_key(self, resource_group, location, storage_accoun with self.assertRaises(ValueError) as e: test_service = service_type('testaccount', credential='', table_name='foo') + # test non-string account URL + with self.assertRaises(ValueError): + test_service = service_type(account_url=123456, credential=storage_account_key, table_name='foo') + self.assertEqual( str(e.exception), "You need to provide either a SAS token or an account shared key to authenticate.") diff --git a/sdk/tables/azure-data-tables/tests/test_table_entity.py b/sdk/tables/azure-data-tables/tests/test_table_entity.py index 6c9797854b39..b9029449f05d 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_entity.py +++ b/sdk/tables/azure-data-tables/tests/test_table_entity.py @@ -906,6 +906,8 @@ def test_update_entity(self, resource_group, location, storage_account, storage_ received_entity = self.table.get_entity(partition_key=entity.PartitionKey, row_key=entity.RowKey) + with self.assertRaises(KeyError): + del received_entity['property_that_does_not_exist'] self._assert_valid_metadata(resp) self._assert_updated_entity(received_entity) finally: From cc2e5d65cb833630a9150ce6b2eb525f764a0ba7 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Wed, 16 Sep 2020 13:58:06 -0700 Subject: [PATCH 04/11] updated unicode test for storage --- sdk/tables/azure-data-tables/tests/test_table.py | 7 ++++--- .../azure-data-tables/tests/test_table_async.py | 11 ++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sdk/tables/azure-data-tables/tests/test_table.py b/sdk/tables/azure-data-tables/tests/test_table.py index 94995f6a213f..c847254d5e57 100644 --- a/sdk/tables/azure-data-tables/tests/test_table.py +++ b/sdk/tables/azure-data-tables/tests/test_table.py @@ -299,7 +299,6 @@ def test_delete_table_with_non_existing_table_fail_not_exist(self, resource_grou # Assert - @pytest.mark.skip("table names must be alphanumeric, why test this?") @GlobalStorageAccountPreparer() def test_unicode_create_table_unicode_name(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -310,10 +309,12 @@ def test_unicode_create_table_unicode_name(self, resource_group, location, stora table_name = u'啊齄丂狛狜' # Act - with self.assertRaises(HttpResponseError): - # not supported - table name must be alphanumeric, lowercase + with self.assertRaises(ValueError) as excinfo: ts.create_table(table_name) + assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str( + excinfo) + # Assert @GlobalStorageAccountPreparer() diff --git a/sdk/tables/azure-data-tables/tests/test_table_async.py b/sdk/tables/azure-data-tables/tests/test_table_async.py index 92932b5ccdc6..e1afb270a4e8 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_async.py @@ -302,15 +302,16 @@ async def test_unicode_create_table_unicode_name(self, resource_group, location, # Arrange url = self.account_url(storage_account, "table") if 'cosmos' in url: - pytest.skip("Cosmos URLs support unicode table names") + pytest.skip("Cosmos URLs do notsupport unicode table names") ts = TableServiceClient(url, storage_account_key) table_name = u'啊齄丂狛狜' - with pytest.raises(ValueError) as excinfo: - await ts.create_table(table_name=table_name) + # Act + with self.assertRaises(ValueError) as excinfo: + await ts.create_table(table_name) - assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str( - excinfo) + assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str( + excinfo) # Assert From eb78103a53c5add815b1dfe974a8362dfe97b7d1 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Wed, 16 Sep 2020 14:25:42 -0700 Subject: [PATCH 05/11] final update --- ...ync.test_list_tables_with_num_results.yaml | 179 ++++-------------- ...t_table_client.test_user_agent_append.yaml | 22 +-- ...t_table_client.test_user_agent_custom.yaml | 75 ++++++-- ..._table_client.test_user_agent_default.yaml | 12 +- .../azure-data-tables/tests/test_table.py | 8 +- .../tests/test_table_batch.py | 2 - 6 files changed, 112 insertions(+), 186 deletions(-) diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_num_results.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_num_results.yaml index 46976dd94efa..bde991dd6ef7 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_num_results.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_num_results.yaml @@ -11,11 +11,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:41:59 GMT + - Wed, 16 Sep 2020 21:25:20 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:41:59 GMT + - Wed, 16 Sep 2020 21:25:20 GMT x-ms-version: - '2019-02-02' method: POST @@ -26,7 +26,7 @@ interactions: headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Fri, 04 Sep 2020 23:41:59 GMT + date: Wed, 16 Sep 2020 21:25:20 GMT location: https://storagename.table.core.windows.net/Tables('listtable0cac14c3') server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked @@ -35,7 +35,7 @@ interactions: status: code: 201 message: Created - url: https://pyacrstorage54hu5ws5glex.table.core.windows.net/Tables + url: https://pyacrstorage3vnro44nfyqn.table.core.windows.net/Tables - request: body: '{"TableName": "listtable1cac14c3"}' headers: @@ -48,11 +48,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT x-ms-version: - '2019-02-02' method: POST @@ -63,7 +63,7 @@ interactions: headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Fri, 04 Sep 2020 23:41:59 GMT + date: Wed, 16 Sep 2020 21:25:20 GMT location: https://storagename.table.core.windows.net/Tables('listtable1cac14c3') server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked @@ -72,7 +72,7 @@ interactions: status: code: 201 message: Created - url: https://pyacrstorage54hu5ws5glex.table.core.windows.net/Tables + url: https://pyacrstorage3vnro44nfyqn.table.core.windows.net/Tables - request: body: '{"TableName": "listtable2cac14c3"}' headers: @@ -85,11 +85,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT x-ms-version: - '2019-02-02' method: POST @@ -100,7 +100,7 @@ interactions: headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Fri, 04 Sep 2020 23:41:59 GMT + date: Wed, 16 Sep 2020 21:25:20 GMT location: https://storagename.table.core.windows.net/Tables('listtable2cac14c3') server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked @@ -109,7 +109,7 @@ interactions: status: code: 201 message: Created - url: https://pyacrstorage54hu5ws5glex.table.core.windows.net/Tables + url: https://pyacrstorage3vnro44nfyqn.table.core.windows.net/Tables - request: body: '{"TableName": "listtable3cac14c3"}' headers: @@ -122,11 +122,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT x-ms-version: - '2019-02-02' method: POST @@ -137,7 +137,7 @@ interactions: headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Fri, 04 Sep 2020 23:41:59 GMT + date: Wed, 16 Sep 2020 21:25:20 GMT location: https://storagename.table.core.windows.net/Tables('listtable3cac14c3') server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked @@ -146,7 +146,7 @@ interactions: status: code: 201 message: Created - url: https://pyacrstorage54hu5ws5glex.table.core.windows.net/Tables + url: https://pyacrstorage3vnro44nfyqn.table.core.windows.net/Tables - request: body: null headers: @@ -155,22 +155,22 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT x-ms-version: - '2019-02-02' method: GET uri: https://storagename.table.core.windows.net/Tables response: body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable051291081"},{"TableName":"listtable0aab312c0"},{"TableName":"listtable0cac14c3"},{"TableName":"listtable151291081"},{"TableName":"listtable1aab312c0"},{"TableName":"listtable1cac14c3"},{"TableName":"listtable251291081"},{"TableName":"listtable2aab312c0"},{"TableName":"listtable2cac14c3"},{"TableName":"listtable351291081"},{"TableName":"listtable3aab312c0"},{"TableName":"listtable3cac14c3"}]}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable0cac14c3"},{"TableName":"listtable1cac14c3"},{"TableName":"listtable2cac14c3"},{"TableName":"listtable3cac14c3"}]}' headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Fri, 04 Sep 2020 23:41:59 GMT + date: Wed, 16 Sep 2020 21:25:20 GMT server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked x-content-type-options: nosniff @@ -178,7 +178,7 @@ interactions: status: code: 200 message: OK - url: https://pyacrstorage54hu5ws5glex.table.core.windows.net/Tables + url: https://pyacrstorage3vnro44nfyqn.table.core.windows.net/Tables - request: body: null headers: @@ -187,31 +187,31 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT x-ms-version: - '2019-02-02' method: GET uri: https://storagename.table.core.windows.net/Tables?$top=3 response: body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable051291081"},{"TableName":"listtable0aab312c0"},{"TableName":"listtable0cac14c3"}]}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable0cac14c3"},{"TableName":"listtable1cac14c3"},{"TableName":"listtable2cac14c3"}]}' headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Fri, 04 Sep 2020 23:41:59 GMT + date: Wed, 16 Sep 2020 21:25:20 GMT server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked x-content-type-options: nosniff - x-ms-continuation-nexttablename: 1!48!bGlzdHRhYmxlMTUxMjkxMDgxATAxZDY4MzE0ZjllNTk2NzA- + x-ms-continuation-nexttablename: 1!48!bGlzdHRhYmxlM2NhYzE0YzMBMDFkNjhjNmZlMThlOWM5Ng-- x-ms-version: '2019-02-02' status: code: 200 message: OK - url: https://pyacrstorage54hu5ws5glex.table.core.windows.net/Tables?$top=3 + url: https://pyacrstorage3vnro44nfyqn.table.core.windows.net/Tables?$top=3 - request: body: null headers: @@ -220,127 +220,28 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 04 Sep 2020 23:42:00 GMT + - Wed, 16 Sep 2020 21:25:20 GMT x-ms-version: - '2019-02-02' method: GET - uri: https://storagename.table.core.windows.net/Tables?$top=3&NextTableName=1!48!bGlzdHRhYmxlMTUxMjkxMDgxATAxZDY4MzE0ZjllNTk2NzA- + uri: https://storagename.table.core.windows.net/Tables?$top=3&NextTableName=1!48!bGlzdHRhYmxlM2NhYzE0YzMBMDFkNjhjNmZlMThlOWM5Ng-- response: body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable151291081"},{"TableName":"listtable1aab312c0"},{"TableName":"listtable1cac14c3"}]}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable3cac14c3"}]}' headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Fri, 04 Sep 2020 23:41:59 GMT + date: Wed, 16 Sep 2020 21:25:20 GMT server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked x-content-type-options: nosniff - x-ms-continuation-nexttablename: 1!48!bGlzdHRhYmxlMjUxMjkxMDgxATAxZDY4MzE0ZjllYjNjYzc- x-ms-version: '2019-02-02' status: code: 200 message: OK - url: https://pyacrstorage54hu5ws5glex.table.core.windows.net/Tables?$top=3&NextTableName=1!48!bGlzdHRhYmxlMTUxMjkxMDgxATAxZDY4MzE0ZjllNTk2NzA- -- request: - body: null - headers: - Accept: - - application/json;odata=minimalmetadata - DataServiceVersion: - - '3.0' - Date: - - Fri, 04 Sep 2020 23:42:00 GMT - User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 04 Sep 2020 23:42:00 GMT - x-ms-version: - - '2019-02-02' - method: GET - uri: https://storagename.table.core.windows.net/Tables?$top=3&NextTableName=1!48!bGlzdHRhYmxlMjUxMjkxMDgxATAxZDY4MzE0ZjllYjNjYzc- - response: - body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable251291081"},{"TableName":"listtable2aab312c0"},{"TableName":"listtable2cac14c3"}]}' - headers: - cache-control: no-cache - content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Fri, 04 Sep 2020 23:41:59 GMT - server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - x-content-type-options: nosniff - x-ms-continuation-nexttablename: 1!48!bGlzdHRhYmxlMzUxMjkxMDgxATAxZDY4MzE0ZjlmMGUzMWE- - x-ms-version: '2019-02-02' - status: - code: 200 - message: OK - url: https://pyacrstorage54hu5ws5glex.table.core.windows.net/Tables?$top=3&NextTableName=1!48!bGlzdHRhYmxlMjUxMjkxMDgxATAxZDY4MzE0ZjllYjNjYzc- -- request: - body: null - headers: - Accept: - - application/json;odata=minimalmetadata - DataServiceVersion: - - '3.0' - Date: - - Fri, 04 Sep 2020 23:42:00 GMT - User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 04 Sep 2020 23:42:00 GMT - x-ms-version: - - '2019-02-02' - method: GET - uri: https://storagename.table.core.windows.net/Tables?$top=3&NextTableName=1!48!bGlzdHRhYmxlMzUxMjkxMDgxATAxZDY4MzE0ZjlmMGUzMWE- - response: - body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable351291081"},{"TableName":"listtable3aab312c0"},{"TableName":"listtable3cac14c3"}]}' - headers: - cache-control: no-cache - content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Fri, 04 Sep 2020 23:41:59 GMT - server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - x-content-type-options: nosniff - x-ms-continuation-nexttablename: 1!48!cHl0YWJsZWFzeW5jMTU1MGUyOAEwMWQ2ODMxNGZiOGMxOTAz - x-ms-version: '2019-02-02' - status: - code: 200 - message: OK - url: https://pyacrstorage54hu5ws5glex.table.core.windows.net/Tables?$top=3&NextTableName=1!48!bGlzdHRhYmxlMzUxMjkxMDgxATAxZDY4MzE0ZjlmMGUzMWE- -- request: - body: null - headers: - Accept: - - application/json;odata=minimalmetadata - DataServiceVersion: - - '3.0' - Date: - - Fri, 04 Sep 2020 23:42:00 GMT - User-Agent: - - azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0) - x-ms-date: - - Fri, 04 Sep 2020 23:42:00 GMT - x-ms-version: - - '2019-02-02' - method: GET - uri: https://storagename.table.core.windows.net/Tables?$top=3&NextTableName=1!48!cHl0YWJsZWFzeW5jMTU1MGUyOAEwMWQ2ODMxNGZiOGMxOTAz - response: - body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' - headers: - cache-control: no-cache - content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Fri, 04 Sep 2020 23:41:59 GMT - server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - transfer-encoding: chunked - x-content-type-options: nosniff - x-ms-version: '2019-02-02' - status: - code: 200 - message: OK - url: https://pyacrstorage54hu5ws5glex.table.core.windows.net/Tables?$top=3&NextTableName=1!48!cHl0YWJsZWFzeW5jMTU1MGUyOAEwMWQ2ODMxNGZiOGMxOTAz + url: https://pyacrstorage3vnro44nfyqn.table.core.windows.net/Tables?$top=3&NextTableName=1!48!bGlzdHRhYmxlM2NhYzE0YzMBMDFkNjhjNmZlMThlOWM5Ng-- version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml index 5e43e4345d35..cb6a1c223ced 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml @@ -11,21 +11,13 @@ interactions: DataServiceVersion: - '3.0' Date: -<<<<<<< HEAD - - Wed, 01 Jul 2020 18:25:06 GMT + - Wed, 16 Sep 2020 21:22:21 GMT User-Agent: - customer_user_agent x-ms-date: - - Wed, 01 Jul 2020 18:25:06 GMT -======= - - Wed, 01 Jul 2020 18:18:37 GMT - User-Agent: - - customer_user_agent - x-ms-date: - - Wed, 01 Jul 2020 18:18:37 GMT ->>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + - Wed, 16 Sep 2020 21:22:21 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: GET uri: https://storagename.table.core.windows.net/Tables response: @@ -37,11 +29,7 @@ interactions: content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: -<<<<<<< HEAD - - Wed, 01 Jul 2020 18:25:05 GMT -======= - - Wed, 01 Jul 2020 18:18:36 GMT ->>>>>>> 8bdf4dab46b1d77ee840080c15bb142508964575 + - Wed, 16 Sep 2020 21:22:21 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -49,7 +37,7 @@ interactions: x-content-type-options: - nosniff x-ms-version: - - '2019-07-07' + - '2019-02-02' status: code: 200 message: OK diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml index 246b2b684cdd..c3be84eeb85a 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml @@ -11,31 +11,76 @@ interactions: DataServiceVersion: - '3.0' Date: - - Mon, 10 Aug 2020 19:03:04 GMT + - Wed, 16 Sep 2020 21:22:22 GMT User-Agent: - - TestApp/v1.0 azsdk-python-storage-table/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - TestApp/v1.0 azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Mon, 10 Aug 2020 19:03:04 GMT + - Wed, 16 Sep 2020 21:22:22 GMT x-ms-version: - - 12.0.0b1 + - '2019-02-02' method: GET uri: https://storagename.table.core.windows.net/Tables response: body: - string: "\uFEFF\r\n\r\n - \ InvalidHeaderValue\r\n The value - for one of the HTTP headers is not in the correct format.\nRequestId:3df2a491-5002-0050-3548-6f9833000000\nTime:2020-08-10T19:03:05.7984754Z\r\n" + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' headers: - content-length: - - '371' + cache-control: + - no-cache content-type: - - application/xml + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Mon, 10 Aug 2020 19:03:05 GMT + - Wed, 16 Sep 2020 21:22:22 GMT server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Wed, 16 Sep 2020 21:22:22 GMT + User-Agent: + - TestApp/v2.0 TestApp/v1.0 azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 16 Sep 2020 21:22:22 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://storagename.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Wed, 16 Sep 2020 21:22:22 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: - code: 400 - message: The value for one of the HTTP headers is not in the correct format. + code: 200 + message: OK version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml index d3da2ae7a6c4..9b02686f6ccc 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml @@ -11,13 +11,13 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 30 Jun 2020 19:45:39 GMT + - Wed, 16 Sep 2020 21:22:22 GMT User-Agent: - - azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 30 Jun 2020 19:45:39 GMT + - Wed, 16 Sep 2020 21:22:22 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: GET uri: https://storagename.table.core.windows.net/Tables response: @@ -29,7 +29,7 @@ interactions: content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 30 Jun 2020 19:45:38 GMT + - Wed, 16 Sep 2020 21:22:21 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -37,7 +37,7 @@ interactions: x-content-type-options: - nosniff x-ms-version: - - '2019-07-07' + - '2019-02-02' status: code: 200 message: OK diff --git a/sdk/tables/azure-data-tables/tests/test_table.py b/sdk/tables/azure-data-tables/tests/test_table.py index c847254d5e57..ce646ca9f352 100644 --- a/sdk/tables/azure-data-tables/tests/test_table.py +++ b/sdk/tables/azure-data-tables/tests/test_table.py @@ -255,8 +255,6 @@ def test_list_tables_with_marker(self, resource_group, location, storage_account for i in range(0, 4): self._create_table(ts, prefix + str(i), table_names) - # table_names.sort() - # Act generator1 = ts.list_tables(results_per_page=2).by_page() next(generator1) @@ -328,13 +326,11 @@ def test_get_table_acl(self, resource_group, location, storage_account, storage_ try: # Act acl = table.get_table_access_policy() - # acl = table.get_table_access_policy() # Assert self.assertIsNotNone(acl) self.assertEqual(len(acl), 0) finally: - # self._delete_table(table) ts.delete_table(table.table_name) @GlobalStorageAccountPreparer() @@ -355,7 +351,6 @@ def test_set_table_acl_with_empty_signed_identifiers(self, resource_group, locat self.assertIsNotNone(acl) self.assertEqual(len(acl), 0) finally: - # self._delete_table(table) ts.delete_table(table.table_name) @GlobalStorageAccountPreparer() @@ -379,7 +374,6 @@ def test_set_table_acl_with_empty_signed_identifier(self, resource_group, locati self.assertIsNone(acl['empty'].expiry) self.assertIsNone(acl['empty'].start) finally: - # self._delete_table(table) ts.delete_table(table.table_name) @GlobalStorageAccountPreparer() @@ -479,7 +473,7 @@ def test_account_sas(self, resource_group, location, storage_account, storage_ac def test_locale(self, resource_group, location, storage_account, storage_account_key): # Arrange ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key) - table = (self._get_table_reference()) + table = self._get_table_reference() init_locale = locale.getlocale() if os.name == "nt": culture = "Spanish_Spain" diff --git a/sdk/tables/azure-data-tables/tests/test_table_batch.py b/sdk/tables/azure-data-tables/tests/test_table_batch.py index b628b10cf508..93bca35e8a6f 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_batch.py +++ b/sdk/tables/azure-data-tables/tests/test_table_batch.py @@ -149,7 +149,6 @@ def _assert_updated_entity(self, entity): self.assertIsInstance(entity.timestamp, datetime) #--Test cases for batch --------------------------------------------- - def test_inferred_types(self): # Arrange # Act @@ -175,7 +174,6 @@ def test_inferred_types(self): self.assertEqual(entity.test7.type, EdmType.INT32) self.assertEqual(entity.test8.type, EdmType.INT64) - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() def test_batch_insert(self, resource_group, location, storage_account, storage_account_key): From 85006a324c21f6c79d8e82587eb19e81c60f3fe7 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Wed, 16 Sep 2020 15:36:19 -0700 Subject: [PATCH 06/11] updates that fix user_agent tests --- ...t_table_client.test_user_agent_append.yaml | 8 ++--- ...t_table_client.test_user_agent_custom.yaml | 16 ++++----- ..._table_client.test_user_agent_default.yaml | 8 ++--- .../tests/test_table_client.py | 2 +- .../tests/test_table_client_async.py | 34 +++++++------------ 5 files changed, 30 insertions(+), 38 deletions(-) diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml index c31287a3c40e..6d3588302f9c 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_append.yaml @@ -11,25 +11,25 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 16 Sep 2020 21:51:26 GMT + - Wed, 16 Sep 2020 22:35:33 GMT User-Agent: - customer_user_agent x-ms-date: - - Wed, 16 Sep 2020 21:51:26 GMT + - Wed, 16 Sep 2020 22:35:33 GMT x-ms-version: - '2019-02-02' method: GET uri: https://storagename.table.core.windows.net/Tables response: body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable03f561007"},{"TableName":"listtable0aab312c0"},{"TableName":"listtable0cac14c3"},{"TableName":"listtable13f561007"},{"TableName":"listtable1aab312c0"},{"TableName":"listtable1cac14c3"},{"TableName":"listtable23f561007"},{"TableName":"listtable2aab312c0"},{"TableName":"listtable2cac14c3"},{"TableName":"listtable33f561007"},{"TableName":"listtable3aab312c0"},{"TableName":"listtable3cac14c3"}]}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Wed, 16 Sep 2020 21:51:26 GMT + - Wed, 16 Sep 2020 22:35:33 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml index 68e9442c04e1..5c1616eca437 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_custom.yaml @@ -11,25 +11,25 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 16 Sep 2020 21:51:26 GMT + - Wed, 16 Sep 2020 22:35:34 GMT User-Agent: - TestApp/v1.0 azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 16 Sep 2020 21:51:26 GMT + - Wed, 16 Sep 2020 22:35:34 GMT x-ms-version: - '2019-02-02' method: GET uri: https://storagename.table.core.windows.net/Tables response: body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable03f561007"},{"TableName":"listtable0aab312c0"},{"TableName":"listtable0cac14c3"},{"TableName":"listtable13f561007"},{"TableName":"listtable1aab312c0"},{"TableName":"listtable1cac14c3"},{"TableName":"listtable23f561007"},{"TableName":"listtable2aab312c0"},{"TableName":"listtable2cac14c3"},{"TableName":"listtable33f561007"},{"TableName":"listtable3aab312c0"},{"TableName":"listtable3cac14c3"}]}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Wed, 16 Sep 2020 21:51:26 GMT + - Wed, 16 Sep 2020 22:35:33 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -53,25 +53,25 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 16 Sep 2020 21:51:26 GMT + - Wed, 16 Sep 2020 22:35:34 GMT User-Agent: - TestApp/v2.0 TestApp/v1.0 azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 16 Sep 2020 21:51:26 GMT + - Wed, 16 Sep 2020 22:35:34 GMT x-ms-version: - '2019-02-02' method: GET uri: https://storagename.table.core.windows.net/Tables response: body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable03f561007"},{"TableName":"listtable0aab312c0"},{"TableName":"listtable0cac14c3"},{"TableName":"listtable13f561007"},{"TableName":"listtable1aab312c0"},{"TableName":"listtable1cac14c3"},{"TableName":"listtable23f561007"},{"TableName":"listtable2aab312c0"},{"TableName":"listtable2cac14c3"},{"TableName":"listtable33f561007"},{"TableName":"listtable3aab312c0"},{"TableName":"listtable3cac14c3"}]}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Wed, 16 Sep 2020 21:51:26 GMT + - Wed, 16 Sep 2020 22:35:33 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml index 1139cf63da10..b9077333648f 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml @@ -11,25 +11,25 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 16 Sep 2020 21:51:27 GMT + - Wed, 16 Sep 2020 22:35:34 GMT User-Agent: - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 16 Sep 2020 21:51:27 GMT + - Wed, 16 Sep 2020 22:35:34 GMT x-ms-version: - '2019-02-02' method: GET uri: https://storagename.table.core.windows.net/Tables response: body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable03f561007"},{"TableName":"listtable0aab312c0"},{"TableName":"listtable0cac14c3"},{"TableName":"listtable13f561007"},{"TableName":"listtable1aab312c0"},{"TableName":"listtable1cac14c3"},{"TableName":"listtable23f561007"},{"TableName":"listtable2aab312c0"},{"TableName":"listtable2cac14c3"},{"TableName":"listtable33f561007"},{"TableName":"listtable3aab312c0"},{"TableName":"listtable3cac14c3"}]}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Wed, 16 Sep 2020 21:51:27 GMT + - Wed, 16 Sep 2020 22:35:34 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: diff --git a/sdk/tables/azure-data-tables/tests/test_table_client.py b/sdk/tables/azure-data-tables/tests/test_table_client.py index 4b998a6e7167..65a4dbd32c50 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_client.py +++ b/sdk/tables/azure-data-tables/tests/test_table_client.py @@ -395,7 +395,7 @@ def test_user_agent_default(self, resource_group, location, storage_account, sto def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) - self.assertEqual( + self.assertIn( response.http_request.headers['User-Agent'], "azsdk-python-data-tables/{} Python/{} ({})".format( VERSION, diff --git a/sdk/tables/azure-data-tables/tests/test_table_client_async.py b/sdk/tables/azure-data-tables/tests/test_table_client_async.py index c7b428ab78db..3c3912152435 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_client_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_client_async.py @@ -353,7 +353,6 @@ async def test_create_service_with_conn_str_succeeds_if_sec_with_primary_async(s 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')) @GlobalStorageAccountPreparer() async def test_create_service_with_custom_account_endpoint_path_async(self, resource_group, location, storage_account, storage_account_key): @@ -391,26 +390,22 @@ async def test_create_service_with_custom_account_endpoint_path_async(self, reso self.assertEqual(service._primary_hostname, 'local-machine:11002/custom/account/path') self.assertTrue(service.url.startswith('http://local-machine:11002/custom/account/path')) - # TODO: AsyncItemPaged is not iterable - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_user_agent_default_async(self, resource_group, location, storage_account, storage_account_key): service = TableServiceClient(self.account_url(storage_account, "table"), credential=storage_account_key) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) - self.assertEqual( + self.assertIn( response.http_request.headers['User-Agent'], - "azsdk-python-storage-table/{} Python/{} ({})".format( + "azsdk-python-data-tables/{} Python/{} ({})".format( VERSION, platform.python_version(), platform.platform())) - tables = list(service.list_tables(raw_response_hook=callback)) - self.assertIsInstance(tables, list) + tables = service.list_tables(raw_response_hook=callback) + self.assertIsNotNone(tables) - # TODO: AsyncItemPaged is not iterable - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_user_agent_custom_async(self, resource_group, location, storage_account, storage_account_key): custom_app = "TestApp/v1.0" @@ -420,49 +415,46 @@ async def test_user_agent_custom_async(self, resource_group, location, storage_a def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) self.assertIn( - "TestApp/v1.0 azsdk-python-storage-table/{} Python/{} ({})".format( + "TestApp/v1.0 azsdk-python-storage-tables/{} Python/{} ({})".format( VERSION, platform.python_version(), platform.platform()), response.http_request.headers['User-Agent'] ) - tables = list(service.list_tables(raw_response_hook=callback)) - self.assertIsInstance(tables, list) + tables = service.list_tables(raw_response_hook=callback) + self.assertIsNotNone(tables) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) self.assertIn( - "TestApp/v2.0 TestApp/v1.0 azsdk-python-storage-table/{} Python/{} ({})".format( + "TestApp/v2.0 TestApp/v1.0 azsdk-python-storage-tables/{} Python/{} ({})".format( VERSION, platform.python_version(), platform.platform()), response.http_request.headers['User-Agent'] ) - tables = list(service.list_tables(raw_response_hook=callback, user_agent="TestApp/v2.0")) - self.assertIsInstance(tables, list) + tables = service.list_tables(raw_response_hook=callback, user_agent="TestApp/v2.0") + self.assertIsNotNone(tables) - # TODO: AsyncItemPaged is not iterable - @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_user_agent_append_async(self, resource_group, location, storage_account, storage_account_key): - # TODO: fix this one service = TableServiceClient(self.account_url(storage_account, "table"), credential=storage_account_key) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) self.assertEqual( response.http_request.headers['User-Agent'], - "azsdk-python-storage-table/{} Python/{} ({}) customer_user_agent".format( + "azsdk-python-storage-tables/{} Python/{} ({}) customer_user_agent".format( VERSION, platform.python_version(), platform.platform()) ) custom_headers = {'User-Agent': 'customer_user_agent'} - tables = list(service.list_tables(raw_response_hook=callback, headers=custom_headers)) - self.assertIsInstance(tables, list) + tables = service.list_tables(raw_response_hook=callback, headers=custom_headers) + self.assertIsNotNone(tables) @GlobalStorageAccountPreparer() async def test_create_table_client_with_complete_table_url_async(self, resource_group, location, storage_account, storage_account_key): From efbe2ed9a9a84d828391c7791c2e1cc2b86cb718 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Thu, 17 Sep 2020 17:20:47 -0700 Subject: [PATCH 07/11] test CI returns a longer user agent so flipping the order for this test should solve the issue --- .../test_table_client.test_user_agent_default.yaml | 6 +++--- .../azure-data-tables/tests/test_table_client.py | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml index b9077333648f..c00bb2b7c5dd 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_client.test_user_agent_default.yaml @@ -11,11 +11,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 16 Sep 2020 22:35:34 GMT + - Fri, 18 Sep 2020 00:20:12 GMT User-Agent: - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 16 Sep 2020 22:35:34 GMT + - Fri, 18 Sep 2020 00:20:12 GMT x-ms-version: - '2019-02-02' method: GET @@ -29,7 +29,7 @@ interactions: content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Wed, 16 Sep 2020 22:35:34 GMT + - Fri, 18 Sep 2020 00:20:12 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: diff --git a/sdk/tables/azure-data-tables/tests/test_table_client.py b/sdk/tables/azure-data-tables/tests/test_table_client.py index 65a4dbd32c50..18f3facd5f85 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_client.py +++ b/sdk/tables/azure-data-tables/tests/test_table_client.py @@ -395,12 +395,11 @@ def test_user_agent_default(self, resource_group, location, storage_account, sto def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) - self.assertIn( - response.http_request.headers['User-Agent'], - "azsdk-python-data-tables/{} Python/{} ({})".format( - VERSION, - platform.python_version(), - platform.platform())) + self.assertIn("azsdk-python-data-tables/{} Python/{} ({})".format( + VERSION, + platform.python_version(), + platform.platform()), + response.http_request.headers['User-Agent']) tables = list(service.list_tables(raw_response_hook=callback)) self.assertIsInstance(tables, list) From 30b42f343dc2968a7e0880f4b98b08ad0b4c7f6f Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Mon, 21 Sep 2020 14:49:38 -0700 Subject: [PATCH 08/11] addresses anna's comments --- .../azure/data/tables/_table_client.py | 6 +- ...le_async.test_list_tables_with_marker.yaml | 93 ++++++++++--------- .../azure-data-tables/tests/test_table.py | 2 - .../tests/test_table_async.py | 40 ++++---- .../tests/test_table_client_async.py | 6 +- 5 files changed, 71 insertions(+), 76 deletions(-) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py index 768d28ddaa2e..aae738b0b248 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py @@ -21,7 +21,7 @@ from ._entity import TableEntity from ._generated import AzureTable from ._generated.models import ( - AccessPolicy, + # AccessPolicy, SignedIdentifier, TableProperties, QueryOptions @@ -32,7 +32,7 @@ from ._serialize import serialize_iso from ._deserialize import _return_headers_and_deserialized from ._error import _process_table_error -from ._models import TableEntityPropertiesPaged, UpdateMode +from ._models import TableEntityPropertiesPaged, UpdateMode, AccessPolicy class TableClient(TableClientBase): @@ -155,7 +155,7 @@ def get_table_access_policy( **kwargs) except HttpResponseError as error: _process_table_error(error) - return {s.id: s.access_policy or AccessPolicy(start=None, expiry=None, permission=None) for s in identifiers} + return {s.id: s.access_policy or AccessPolicy() for s in identifiers} @distributed_trace def set_table_access_policy( diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_marker.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_marker.yaml index f9338c2477f8..97a777a8ea1f 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_marker.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_list_tables_with_marker.yaml @@ -11,13 +11,13 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 22 Jul 2020 19:11:34 GMT + - Mon, 21 Sep 2020 21:49:13 GMT User-Agent: - - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 22 Jul 2020 19:11:34 GMT + - Mon, 21 Sep 2020 21:49:13 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: POST uri: https://storagename.table.core.windows.net/Tables response: @@ -26,16 +26,16 @@ interactions: headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Wed, 22 Jul 2020 19:11:34 GMT + date: Mon, 21 Sep 2020 21:49:12 GMT location: https://storagename.table.core.windows.net/Tables('listtable0a9041284') server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked x-content-type-options: nosniff - x-ms-version: '2019-07-07' + x-ms-version: '2019-02-02' status: code: 201 message: Created - url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables + url: https://pyacrstoragezni7g6kxg6rj.table.core.windows.net/Tables - request: body: '{"TableName": "listtable1a9041284"}' headers: @@ -48,13 +48,13 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 22 Jul 2020 19:11:34 GMT + - Mon, 21 Sep 2020 21:49:13 GMT User-Agent: - - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 22 Jul 2020 19:11:34 GMT + - Mon, 21 Sep 2020 21:49:13 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: POST uri: https://storagename.table.core.windows.net/Tables response: @@ -63,16 +63,16 @@ interactions: headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Wed, 22 Jul 2020 19:11:34 GMT + date: Mon, 21 Sep 2020 21:49:13 GMT location: https://storagename.table.core.windows.net/Tables('listtable1a9041284') server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked x-content-type-options: nosniff - x-ms-version: '2019-07-07' + x-ms-version: '2019-02-02' status: code: 201 message: Created - url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables + url: https://pyacrstoragezni7g6kxg6rj.table.core.windows.net/Tables - request: body: '{"TableName": "listtable2a9041284"}' headers: @@ -85,13 +85,13 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 22 Jul 2020 19:11:34 GMT + - Mon, 21 Sep 2020 21:49:13 GMT User-Agent: - - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 22 Jul 2020 19:11:34 GMT + - Mon, 21 Sep 2020 21:49:13 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: POST uri: https://storagename.table.core.windows.net/Tables response: @@ -100,16 +100,16 @@ interactions: headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Wed, 22 Jul 2020 19:11:35 GMT + date: Mon, 21 Sep 2020 21:49:13 GMT location: https://storagename.table.core.windows.net/Tables('listtable2a9041284') server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked x-content-type-options: nosniff - x-ms-version: '2019-07-07' + x-ms-version: '2019-02-02' status: code: 201 message: Created - url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables + url: https://pyacrstoragezni7g6kxg6rj.table.core.windows.net/Tables - request: body: '{"TableName": "listtable3a9041284"}' headers: @@ -122,13 +122,13 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 22 Jul 2020 19:11:34 GMT + - Mon, 21 Sep 2020 21:49:13 GMT User-Agent: - - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 22 Jul 2020 19:11:34 GMT + - Mon, 21 Sep 2020 21:49:13 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: POST uri: https://storagename.table.core.windows.net/Tables response: @@ -137,16 +137,16 @@ interactions: headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Wed, 22 Jul 2020 19:11:35 GMT + date: Mon, 21 Sep 2020 21:49:13 GMT location: https://storagename.table.core.windows.net/Tables('listtable3a9041284') server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked x-content-type-options: nosniff - x-ms-version: '2019-07-07' + x-ms-version: '2019-02-02' status: code: 201 message: Created - url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables + url: https://pyacrstoragezni7g6kxg6rj.table.core.windows.net/Tables - request: body: null headers: @@ -155,30 +155,31 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 22 Jul 2020 19:11:35 GMT + - Mon, 21 Sep 2020 21:49:13 GMT User-Agent: - - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 22 Jul 2020 19:11:35 GMT + - Mon, 21 Sep 2020 21:49:13 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: GET - uri: https://storagename.table.core.windows.net/Tables + uri: https://storagename.table.core.windows.net/Tables?$top=2 response: body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable0a9041284"},{"TableName":"listtable1a9041284"},{"TableName":"listtable2a9041284"},{"TableName":"listtable3a9041284"}]}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable0a9041284"},{"TableName":"listtable1a9041284"}]}' headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Wed, 22 Jul 2020 19:11:35 GMT + date: Mon, 21 Sep 2020 21:49:13 GMT server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked x-content-type-options: nosniff - x-ms-version: '2019-07-07' + x-ms-continuation-nexttablename: 1!48!bGlzdHRhYmxlMmE5MDQxMjg0ATAxZDY5MDYxMGJkOGI3ZDk- + x-ms-version: '2019-02-02' status: code: 200 message: OK - url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables + url: https://pyacrstoragezni7g6kxg6rj.table.core.windows.net/Tables?$top=2 - request: body: null headers: @@ -187,28 +188,28 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 22 Jul 2020 19:11:35 GMT + - Mon, 21 Sep 2020 21:49:13 GMT User-Agent: - - azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 22 Jul 2020 19:11:35 GMT + - Mon, 21 Sep 2020 21:49:13 GMT x-ms-version: - - '2019-07-07' + - '2019-02-02' method: GET - uri: https://storagename.table.core.windows.net/Tables + uri: https://storagename.table.core.windows.net/Tables?$top=2&NextTableName=1!48!bGlzdHRhYmxlMmE5MDQxMjg0ATAxZDY5MDYxMGJkOGI3ZDk- response: body: - string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable0a9041284"},{"TableName":"listtable1a9041284"},{"TableName":"listtable2a9041284"},{"TableName":"listtable3a9041284"}]}' + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"listtable2a9041284"},{"TableName":"listtable3a9041284"}]}' headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Wed, 22 Jul 2020 19:11:35 GMT + date: Mon, 21 Sep 2020 21:49:13 GMT server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked x-content-type-options: nosniff - x-ms-version: '2019-07-07' + x-ms-version: '2019-02-02' status: code: 200 message: OK - url: https://pyacrstoragejssq3z2qvrzy.table.core.windows.net/Tables + url: https://pyacrstoragezni7g6kxg6rj.table.core.windows.net/Tables?$top=2&NextTableName=1!48!bGlzdHRhYmxlMmE5MDQxMjg0ATAxZDY5MDYxMGJkOGI3ZDk- version: 1 diff --git a/sdk/tables/azure-data-tables/tests/test_table.py b/sdk/tables/azure-data-tables/tests/test_table.py index ce646ca9f352..a8bdb7f0fe8e 100644 --- a/sdk/tables/azure-data-tables/tests/test_table.py +++ b/sdk/tables/azure-data-tables/tests/test_table.py @@ -313,8 +313,6 @@ def test_unicode_create_table_unicode_name(self, resource_group, location, stora assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str( excinfo) - # Assert - @GlobalStorageAccountPreparer() def test_get_table_acl(self, resource_group, location, storage_account, storage_account_key): # Arrange diff --git a/sdk/tables/azure-data-tables/tests/test_table_async.py b/sdk/tables/azure-data-tables/tests/test_table_async.py index d962ef79ed73..129a299eac15 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_async.py @@ -239,7 +239,7 @@ async def test_list_tables_with_num_results(self, resource_group, location, stor self.assertEqual(len(small_page), 2) self.assertGreaterEqual(len(big_page), 4) - @pytest.mark.skip("pending") + # @pytest.mark.skip("pending") @GlobalStorageAccountPreparer() async def test_list_tables_with_marker(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -251,18 +251,21 @@ async def test_list_tables_with_marker(self, resource_group, location, storage_a # Act generator1 = ts.list_tables(results_per_page=2).by_page() - tables1 = [] - for el in generator1: - tables1.append(el) + await generator1.__anext__() + generator2 = ts.list_tables(results_per_page=2).by_page( continuation_token=generator1.continuation_token) - tables2 = [] - for el in generator2: - tables2.append(el) + await generator2.__anext__() + + tables1 = generator1._current_page + tables2 = generator2._current_page + + table1_len = len([t async for t in tables1]) + table2_len = len([t async for t in tables2]) # Assert - self.assertEqual(len(tables1), 2) - self.assertEqual(len(tables2), 2) + self.assertEqual(table1_len, 2) + self.assertEqual(table2_len, 2) self.assertNotEqual(tables1, tables2) @GlobalStorageAccountPreparer() @@ -273,14 +276,13 @@ async def test_delete_table_with_existing_table(self, resource_group, location, table = await self._create_table(ts) # Act - # deleted = table.delete_table() - deleted = await ts.delete_table(table_name=table.table_name) + await ts.delete_table(table_name=table.table_name) - # Assert - self.assertIsNone(deleted) - # TODO: the AsyncPageIterator is not an iterable and this check fails - # existing = ts.query_tables("TableName eq '{}'".format(table.table_name)) - # self.assertEqual(existing, []) + existing = ts.query_tables("TableName eq '{}'".format(table.table_name)) + tables = [] + async for e in existing: + tables.append(e) + self.assertEqual(tables, []) @GlobalStorageAccountPreparer() async def test_delete_table_with_non_existing_table_fail_not_exist(self, resource_group, location, storage_account, @@ -293,8 +295,6 @@ async def test_delete_table_with_non_existing_table_fail_not_exist(self, resourc with self.assertRaises(ResourceNotFoundError): await ts.delete_table(table_name) - # Assert - @GlobalStorageAccountPreparer() async def test_unicode_create_table_unicode_name(self, resource_group, location, storage_account, storage_account_key): @@ -312,8 +312,6 @@ async def test_unicode_create_table_unicode_name(self, resource_group, location, assert "Table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str( excinfo) - # Assert - @GlobalStorageAccountPreparer() async def test_get_table_acl(self, resource_group, location, storage_account, storage_account_key): # Arrange @@ -325,13 +323,11 @@ async def test_get_table_acl(self, resource_group, location, storage_account, st try: # Act acl = await table.get_table_access_policy() - # acl = table.get_table_access_policy() # Assert self.assertIsNotNone(acl) self.assertEqual(len(acl), 0) finally: - # self._delete_table(table) await ts.delete_table(table.table_name) @GlobalStorageAccountPreparer() diff --git a/sdk/tables/azure-data-tables/tests/test_table_client_async.py b/sdk/tables/azure-data-tables/tests/test_table_client_async.py index 3c3912152435..b00f20ad6b05 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_client_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_client_async.py @@ -415,7 +415,7 @@ async def test_user_agent_custom_async(self, resource_group, location, storage_a def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) self.assertIn( - "TestApp/v1.0 azsdk-python-storage-tables/{} Python/{} ({})".format( + "TestApp/v1.0 azsdk-python-data-tables/{} Python/{} ({})".format( VERSION, platform.python_version(), platform.platform()), @@ -428,7 +428,7 @@ def callback(response): def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) self.assertIn( - "TestApp/v2.0 TestApp/v1.0 azsdk-python-storage-tables/{} Python/{} ({})".format( + "TestApp/v2.0 TestApp/v1.0 azsdk-python-data-tables/{} Python/{} ({})".format( VERSION, platform.python_version(), platform.platform()), @@ -446,7 +446,7 @@ def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) self.assertEqual( response.http_request.headers['User-Agent'], - "azsdk-python-storage-tables/{} Python/{} ({}) customer_user_agent".format( + "azsdk-python-data-tables/{} Python/{} ({}) customer_user_agent".format( VERSION, platform.python_version(), platform.platform()) From 866731997e654d45b0c0f5f2502681fc51aa2429 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Mon, 21 Sep 2020 15:27:42 -0700 Subject: [PATCH 09/11] re-recorded a test with a recording error --- ...test_delete_table_with_existing_table.yaml | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_existing_table.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_existing_table.yaml index c04b341e5a61..72678943d896 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_existing_table.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_async.test_delete_table_with_existing_table.yaml @@ -11,11 +11,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Wed, 16 Sep 2020 21:51:23 GMT + - Mon, 21 Sep 2020 22:27:15 GMT User-Agent: - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 16 Sep 2020 21:51:23 GMT + - Mon, 21 Sep 2020 22:27:15 GMT x-ms-version: - '2019-02-02' method: POST @@ -26,7 +26,7 @@ interactions: headers: cache-control: no-cache content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - date: Wed, 16 Sep 2020 21:51:23 GMT + date: Mon, 21 Sep 2020 22:27:15 GMT location: https://storagename.table.core.windows.net/Tables('pytableasync5ef31618') server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked @@ -35,18 +35,18 @@ interactions: status: code: 201 message: Created - url: https://pyacrstoragewrla36mtikyp.table.core.windows.net/Tables + url: https://pyacrstorageghacaclki5ok.table.core.windows.net/Tables - request: body: null headers: Accept: - application/json Date: - - Wed, 16 Sep 2020 21:51:23 GMT + - Mon, 21 Sep 2020 22:27:15 GMT User-Agent: - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 16 Sep 2020 21:51:23 GMT + - Mon, 21 Sep 2020 22:27:15 GMT x-ms-version: - '2019-02-02' method: DELETE @@ -57,12 +57,44 @@ interactions: headers: cache-control: no-cache content-length: '0' - date: Wed, 16 Sep 2020 21:51:23 GMT + date: Mon, 21 Sep 2020 22:27:15 GMT server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 x-content-type-options: nosniff x-ms-version: '2019-02-02' status: code: 204 message: No Content - url: https://pyacrstoragewrla36mtikyp.table.core.windows.net/Tables('pytableasync5ef31618') + url: https://pyacrstorageghacaclki5ok.table.core.windows.net/Tables('pytableasync5ef31618') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Mon, 21 Sep 2020 22:27:15 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b2 Python/3.8.4 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Mon, 21 Sep 2020 22:27:15 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://storagename.table.core.windows.net/Tables?$filter=TableName%20eq%20'pytableasync5ef31618' + response: + body: + string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Mon, 21 Sep 2020 22:27:15 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' + status: + code: 200 + message: OK + url: https://pyacrstorageghacaclki5ok.table.core.windows.net/Tables?$filter=TableName%20eq%20'pytableasync5ef31618' version: 1 From e441d45feba8626b1e2cfdf34720adb0b823bae8 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Mon, 21 Sep 2020 15:54:49 -0700 Subject: [PATCH 10/11] removed list comprehension for python3.5 compatability --- sdk/tables/azure-data-tables/tests/test_table_async.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sdk/tables/azure-data-tables/tests/test_table_async.py b/sdk/tables/azure-data-tables/tests/test_table_async.py index 129a299eac15..f2667c3cc528 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_async.py @@ -260,8 +260,14 @@ async def test_list_tables_with_marker(self, resource_group, location, storage_a tables1 = generator1._current_page tables2 = generator2._current_page - table1_len = len([t async for t in tables1]) - table2_len = len([t async for t in tables2]) + tables1_len = 0 + async for _ in tables1: + tables1_len += 1 + tables2_len = 0 + async for _ in tables2: + tables2_len += 1 + # table1_len = len([t async for t in tables1]) + # table2_len = len([t async for t in tables2]) # Assert self.assertEqual(table1_len, 2) From d7426ddf3a5a3fc74f76aad83197000663c1f3ad Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Tue, 22 Sep 2020 08:19:51 -0700 Subject: [PATCH 11/11] fixing a testing bug --- sdk/tables/azure-data-tables/tests/test_table_async.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sdk/tables/azure-data-tables/tests/test_table_async.py b/sdk/tables/azure-data-tables/tests/test_table_async.py index f2667c3cc528..81c338a845fd 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_async.py @@ -266,12 +266,10 @@ async def test_list_tables_with_marker(self, resource_group, location, storage_a tables2_len = 0 async for _ in tables2: tables2_len += 1 - # table1_len = len([t async for t in tables1]) - # table2_len = len([t async for t in tables2]) # Assert - self.assertEqual(table1_len, 2) - self.assertEqual(table2_len, 2) + self.assertEqual(tables1_len, 2) + self.assertEqual(tables2_len, 2) self.assertNotEqual(tables1, tables2) @GlobalStorageAccountPreparer()