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 d88ea7e2357b..fe3b62db99d7 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 @@ -5,7 +5,7 @@ # -------------------------------------------------------------------------- import functools -from typing import Optional, Any, Union, List, Tuple, Dict, Mapping, Iterable +from typing import Optional, Any, Union, List, Tuple, Dict, Mapping, Iterable, overload try: from urllib.parse import urlparse, unquote except ImportError: @@ -273,14 +273,19 @@ def delete_table( except HttpResponseError as error: _process_table_error(error) + @overload + def delete_entity(self, partition_key, row_key, **kwargs): + # type: (str, str, Any) -> None + pass + + @overload + def delete_entity(self, entity, **kwargs): + # type: (Union[TableEntity, Mapping[str, Any]], Any) -> None + pass + @distributed_trace - def delete_entity( - self, - partition_key, # type: str - row_key, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + def delete_entity(self, *args, **kwargs): + # type: (Union[TableEntity, str], Any) -> None """Deletes the specified entity in a table. :param partition_key: The partition key of the entity. @@ -303,6 +308,20 @@ def delete_entity( :dedent: 8 :caption: Deleting an entity to a Table """ + try: + entity = kwargs.pop('entity', None) + if not entity: + entity = args[0] + partition_key = entity['PartitionKey'] + row_key = entity['RowKey'] + except (TypeError, IndexError): + partition_key = kwargs.pop('partition_key', None) + if not partition_key: + partition_key = args[0] + row_key = kwargs.pop("row_key", None) + if not row_key: + row_key = args[1] + if_match, _ = _get_match_headers( kwargs=dict( 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 a771860a508e..4e27e37b16c9 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 @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import functools -from typing import List, Union, Any, Optional, Mapping, Iterable +from typing import List, Union, Any, Optional, Mapping, Iterable, Dict, overload try: from urllib.parse import urlparse, unquote except ImportError: @@ -264,13 +264,16 @@ async def delete_table(self, **kwargs) -> None: except HttpResponseError as error: _process_table_error(error) + @overload + async def delete_entity(self, partition_key: str, row_key: str, **kwargs: Any) -> None: + ... + + @overload + async def delete_entity(self, entity: Union[TableEntity, Mapping[str, Any]], **kwargs: Any) -> None: + ... + @distributed_trace_async - async def delete_entity( - self, - partition_key: str, - row_key: str, - **kwargs - ) -> None: + async def delete_entity(self, *args: Union[TableEntity, str], **kwargs: Any) -> None: """Deletes the specified entity in a table. :param partition_key: The partition key of the entity. @@ -293,6 +296,20 @@ async def delete_entity( :dedent: 8 :caption: Adding an entity to a Table """ + try: + entity = kwargs.pop('entity', None) + if not entity: + entity = args[0] + partition_key = entity['PartitionKey'] + row_key = entity['RowKey'] + except (TypeError, IndexError): + partition_key = kwargs.pop('partition_key', None) + if not partition_key: + partition_key = args[0] + row_key = kwargs.pop("row_key", None) + if not row_key: + row_key = args[1] + if_match, _ = _get_match_headers( kwargs=dict( kwargs, diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_overloads.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_overloads.yaml new file mode 100644 index 000000000000..3de0f20f8285 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_overloads.yaml @@ -0,0 +1,328 @@ +interactions: +- request: + body: '{"TableName": "uttablebdf6130e"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:04 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:04 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttablebdf6130e"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 04 May 2021 19:45:04 GMT + location: + - https://fake_table_account.table.core.windows.net/Tables('uttablebdf6130e') + 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: '{"PartitionKey": "pkbdf6130e", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rkbdf6130e", "RowKey@odata.type": "Edm.String", "age": 39, "sex": + "male", "sex@odata.type": "Edm.String", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": 933311100, "Birthday": "1973-10-04T00:00:00.000000Z", + "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00.000000Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '591' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:04 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:04 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttablebdf6130e + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttablebdf6130e/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A45%3A05.1450594Z''\"","PartitionKey":"pkbdf6130e","RowKey":"rkbdf6130e","Timestamp":"2021-05-04T19:45:05.1450594Z","age":39,"sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":933311100,"Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 04 May 2021 19:45:04 GMT + etag: + - W/"datetime'2021-05-04T19%3A45%3A05.1450594Z'" + location: + - https://fake_table_account.table.core.windows.net/uttablebdf6130e(PartitionKey='pkbdf6130e',RowKey='rkbdf6130e') + 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/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:05 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:05 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttablebdf6130e(PartitionKey='pkbdf6130e',RowKey='rkbdf6130e') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 04 May 2021 19:45:04 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 +- request: + body: '{"PartitionKey": "pk2", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk2", "RowKey@odata.type": "Edm.String", "Value": 100}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '130' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:05 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:05 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttablebdf6130e + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttablebdf6130e/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A45%3A05.4472729Z''\"","PartitionKey":"pk2","RowKey":"rk2","Timestamp":"2021-05-04T19:45:05.4472729Z","Value":100}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 04 May 2021 19:45:04 GMT + etag: + - W/"datetime'2021-05-04T19%3A45%3A05.4472729Z'" + location: + - https://fake_table_account.table.core.windows.net/uttablebdf6130e(PartitionKey='pk2',RowKey='rk2') + 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/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:05 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:05 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttablebdf6130e(PartitionKey='pk2',RowKey='rk2') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 04 May 2021 19:45:04 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 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:05 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:05 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttablebdf6130e() + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttablebdf6130e","value":[]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 04 May 2021 19:45:05 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 +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Tue, 04 May 2021 19:45:05 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:05 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttablebdf6130e') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 04 May 2021 19:45:05 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_entity.test_delete_entity_overloads_kwargs.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_overloads_kwargs.yaml new file mode 100644 index 000000000000..cbadd882a8f1 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_overloads_kwargs.yaml @@ -0,0 +1,328 @@ +interactions: +- request: + body: '{"TableName": "uttable4ef015fc"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:05 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:05 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable4ef015fc"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 04 May 2021 19:45:05 GMT + location: + - https://fake_table_account.table.core.windows.net/Tables('uttable4ef015fc') + 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: '{"PartitionKey": "pk4ef015fc", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rk4ef015fc", "RowKey@odata.type": "Edm.String", "age": 39, "sex": + "male", "sex@odata.type": "Edm.String", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": 933311100, "Birthday": "1973-10-04T00:00:00.000000Z", + "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00.000000Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '591' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:06 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:06 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttable4ef015fc + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable4ef015fc/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A45%3A06.5367606Z''\"","PartitionKey":"pk4ef015fc","RowKey":"rk4ef015fc","Timestamp":"2021-05-04T19:45:06.5367606Z","age":39,"sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":933311100,"Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 04 May 2021 19:45:05 GMT + etag: + - W/"datetime'2021-05-04T19%3A45%3A06.5367606Z'" + location: + - https://fake_table_account.table.core.windows.net/uttable4ef015fc(PartitionKey='pk4ef015fc',RowKey='rk4ef015fc') + 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/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:06 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:06 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttable4ef015fc(PartitionKey='pk4ef015fc',RowKey='rk4ef015fc') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 04 May 2021 19:45: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 +- request: + body: '{"PartitionKey": "pk2", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk2", "RowKey@odata.type": "Edm.String", "Value": 100}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '130' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:06 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:06 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttable4ef015fc + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable4ef015fc/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A45%3A06.8399788Z''\"","PartitionKey":"pk2","RowKey":"rk2","Timestamp":"2021-05-04T19:45:06.8399788Z","Value":100}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 04 May 2021 19:45:06 GMT + etag: + - W/"datetime'2021-05-04T19%3A45%3A06.8399788Z'" + location: + - https://fake_table_account.table.core.windows.net/uttable4ef015fc(PartitionKey='pk2',RowKey='rk2') + 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/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:06 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:06 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttable4ef015fc(PartitionKey='pk2',RowKey='rk2') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 04 May 2021 19:45: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 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:45:06 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:06 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttable4ef015fc() + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable4ef015fc","value":[]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 04 May 2021 19:45:06 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 +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Tue, 04 May 2021 19:45:07 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:45:07 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttable4ef015fc') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 04 May 2021 19:45: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 +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_overloads.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_overloads.yaml new file mode 100644 index 000000000000..20384c0b42b2 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_overloads.yaml @@ -0,0 +1,250 @@ +interactions: +- request: + body: '{"TableName": "uttable399b158b"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:30 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:30 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable399b158b"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 04 May 2021 19:43:29 GMT + location: https://fake_table_account.table.core.windows.net/Tables('uttable399b158b') + 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://seankaneprim.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pk399b158b", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rk399b158b", "RowKey@odata.type": "Edm.String", "age": 39, "sex": + "male", "sex@odata.type": "Edm.String", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": 933311100, "Birthday": "1973-10-04T00:00:00.000000Z", + "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00.000000Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '591' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:30 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:30 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttable399b158b + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable399b158b/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A43%3A30.6953206Z''\"","PartitionKey":"pk399b158b","RowKey":"rk399b158b","Timestamp":"2021-05-04T19:43:30.6953206Z","age":39,"sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":933311100,"Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 04 May 2021 19:43:29 GMT + etag: W/"datetime'2021-05-04T19%3A43%3A30.6953206Z'" + location: https://fake_table_account.table.core.windows.net/uttable399b158b(PartitionKey='pk399b158b',RowKey='rk399b158b') + 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://seankaneprim.table.core.windows.net/uttable399b158b +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:30 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:30 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttable399b158b(PartitionKey='pk399b158b',RowKey='rk399b158b') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Tue, 04 May 2021 19:43:29 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://seankaneprim.table.core.windows.net/uttable399b158b(PartitionKey='pk399b158b',RowKey='rk399b158b') +- request: + body: '{"PartitionKey": "pk2", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk2", "RowKey@odata.type": "Edm.String", "Value": 100}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '130' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:30 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:30 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttable399b158b + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable399b158b/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A43%3A30.9174802Z''\"","PartitionKey":"pk2","RowKey":"rk2","Timestamp":"2021-05-04T19:43:30.9174802Z","Value":100}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 04 May 2021 19:43:29 GMT + etag: W/"datetime'2021-05-04T19%3A43%3A30.9174802Z'" + location: https://fake_table_account.table.core.windows.net/uttable399b158b(PartitionKey='pk2',RowKey='rk2') + 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://seankaneprim.table.core.windows.net/uttable399b158b +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:30 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:30 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttable399b158b(PartitionKey='pk2',RowKey='rk2') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Tue, 04 May 2021 19:43:30 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://seankaneprim.table.core.windows.net/uttable399b158b(PartitionKey='pk2',RowKey='rk2') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:31 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:31 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttable399b158b() + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable399b158b","value":[]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 04 May 2021 19:43:30 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://seankaneprim.table.core.windows.net/uttable399b158b() +- request: + body: null + headers: + Accept: + - application/json + Date: + - Tue, 04 May 2021 19:43:31 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:31 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttable399b158b') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Tue, 04 May 2021 19:43:30 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://seankaneprim.table.core.windows.net/Tables('uttable399b158b') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_overloads_kwargs.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_overloads_kwargs.yaml new file mode 100644 index 000000000000..3b290223effd --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_delete_entity_overloads_kwargs.yaml @@ -0,0 +1,250 @@ +interactions: +- request: + body: '{"TableName": "uttabledbf11879"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:31 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:31 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttabledbf11879"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 04 May 2021 19:43:31 GMT + location: https://fake_table_account.table.core.windows.net/Tables('uttabledbf11879') + 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://seankaneprim.table.core.windows.net/Tables +- request: + body: '{"PartitionKey": "pkdbf11879", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rkdbf11879", "RowKey@odata.type": "Edm.String", "age": 39, "sex": + "male", "sex@odata.type": "Edm.String", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": 933311100, "Birthday": "1973-10-04T00:00:00.000000Z", + "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00.000000Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '591' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:31 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:31 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttabledbf11879 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttabledbf11879/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A43%3A31.8443953Z''\"","PartitionKey":"pkdbf11879","RowKey":"rkdbf11879","Timestamp":"2021-05-04T19:43:31.8443953Z","age":39,"sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":933311100,"Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 04 May 2021 19:43:31 GMT + etag: W/"datetime'2021-05-04T19%3A43%3A31.8443953Z'" + location: https://fake_table_account.table.core.windows.net/uttabledbf11879(PartitionKey='pkdbf11879',RowKey='rkdbf11879') + 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://seankaneprim.table.core.windows.net/uttabledbf11879 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:31 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:31 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttabledbf11879(PartitionKey='pkdbf11879',RowKey='rkdbf11879') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Tue, 04 May 2021 19:43:31 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://seankaneprim.table.core.windows.net/uttabledbf11879(PartitionKey='pkdbf11879',RowKey='rkdbf11879') +- request: + body: '{"PartitionKey": "pk2", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk2", "RowKey@odata.type": "Edm.String", "Value": 100}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '130' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:31 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:31 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttabledbf11879 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttabledbf11879/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A43%3A32.0635526Z''\"","PartitionKey":"pk2","RowKey":"rk2","Timestamp":"2021-05-04T19:43:32.0635526Z","Value":100}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 04 May 2021 19:43:32 GMT + etag: W/"datetime'2021-05-04T19%3A43%3A32.0635526Z'" + location: https://fake_table_account.table.core.windows.net/uttabledbf11879(PartitionKey='pk2',RowKey='rk2') + 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://seankaneprim.table.core.windows.net/uttabledbf11879 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:32 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:32 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttabledbf11879(PartitionKey='pk2',RowKey='rk2') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Tue, 04 May 2021 19:43:32 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://seankaneprim.table.core.windows.net/uttabledbf11879(PartitionKey='pk2',RowKey='rk2') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:32 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:32 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttabledbf11879() + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttabledbf11879","value":[]}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 04 May 2021 19:43:32 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://seankaneprim.table.core.windows.net/uttabledbf11879() +- request: + body: null + headers: + Accept: + - application/json + Date: + - Tue, 04 May 2021 19:43:32 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:32 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttabledbf11879') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Tue, 04 May 2021 19:43:32 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://seankaneprim.table.core.windows.net/Tables('uttabledbf11879') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_delete_entity_overloads.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_delete_entity_overloads.yaml new file mode 100644 index 000000000000..55ea9611d627 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_delete_entity_overloads.yaml @@ -0,0 +1,324 @@ +interactions: +- request: + body: '{"TableName": "uttable51021601"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:32 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:32 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable51021601","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 04 May 2021 19:43:33 GMT + etag: + - W/"datetime'2021-05-04T19%3A43%3A33.4303752Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable51021601') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Ok +- request: + body: '{"PartitionKey": "pk51021601", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rk51021601", "RowKey@odata.type": "Edm.String", "age": 39, "sex": + "male", "sex@odata.type": "Edm.String", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": 933311100, "Birthday": "1973-10-04T00:00:00.000000Z", + "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00.000000Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '591' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:33 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:33 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable51021601 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable51021601/$metadata#uttable51021601/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A43%3A34.1011976Z''\"","PartitionKey":"pk51021601","RowKey":"rk51021601","age":39,"sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":933311100,"Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00.0000000Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00.0000000Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","Timestamp":"2021-05-04T19:43:34.1011976Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 04 May 2021 19:43:33 GMT + etag: + - W/"datetime'2021-05-04T19%3A43%3A34.1011976Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttable51021601(PartitionKey='pk51021601',RowKey='rk51021601') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:34 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:34 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable51021601(PartitionKey='pk51021601',RowKey='rk51021601') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 04 May 2021 19:43:33 GMT + server: + - Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content +- request: + body: '{"PartitionKey": "pk2", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk2", "RowKey@odata.type": "Edm.String", "Value": 100}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '130' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:34 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:34 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable51021601 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable51021601/$metadata#uttable51021601/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A43%3A34.3622152Z''\"","PartitionKey":"pk2","RowKey":"rk2","Value":100,"Timestamp":"2021-05-04T19:43:34.3622152Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 04 May 2021 19:43:33 GMT + etag: + - W/"datetime'2021-05-04T19%3A43%3A34.3622152Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttable51021601(PartitionKey='pk2',RowKey='rk2') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:34 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:34 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable51021601(PartitionKey='pk2',RowKey='rk2') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 04 May 2021 19:43:33 GMT + server: + - Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:34 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:34 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable51021601() + response: + body: + string: '{"value":[],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable51021601"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 04 May 2021 19:43:33 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: Ok +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Tue, 04 May 2021 19:43:34 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:34 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable51021601') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 04 May 2021 19:43:34 GMT + server: + - Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:35 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:35 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"value":[],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 04 May 2021 19:43:34 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: Ok +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_delete_entity_overloads_kwargs.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_delete_entity_overloads_kwargs.yaml new file mode 100644 index 000000000000..1527a6f84172 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_delete_entity_overloads_kwargs.yaml @@ -0,0 +1,324 @@ +interactions: +- request: + body: '{"TableName": "uttablef69218ef"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:35 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:35 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttablef69218ef","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 04 May 2021 19:43:36 GMT + etag: + - W/"datetime'2021-05-04T19%3A43%3A36.0299016Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttablef69218ef') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Ok +- request: + body: '{"PartitionKey": "pkf69218ef", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rkf69218ef", "RowKey@odata.type": "Edm.String", "age": 39, "sex": + "male", "sex@odata.type": "Edm.String", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": 933311100, "Birthday": "1973-10-04T00:00:00.000000Z", + "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00.000000Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '591' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:36 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:36 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablef69218ef + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttablef69218ef/$metadata#uttablef69218ef/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A43%3A36.6675464Z''\"","PartitionKey":"pkf69218ef","RowKey":"rkf69218ef","age":39,"sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":933311100,"Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00.0000000Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00.0000000Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","Timestamp":"2021-05-04T19:43:36.6675464Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 04 May 2021 19:43:36 GMT + etag: + - W/"datetime'2021-05-04T19%3A43%3A36.6675464Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttablef69218ef(PartitionKey='pkf69218ef',RowKey='rkf69218ef') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:36 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:36 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablef69218ef(PartitionKey='pkf69218ef',RowKey='rkf69218ef') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 04 May 2021 19:43:36 GMT + server: + - Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content +- request: + body: '{"PartitionKey": "pk2", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk2", "RowKey@odata.type": "Edm.String", "Value": 100}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '130' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:36 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:36 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablef69218ef + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttablef69218ef/$metadata#uttablef69218ef/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A43%3A36.9239560Z''\"","PartitionKey":"pk2","RowKey":"rk2","Value":100,"Timestamp":"2021-05-04T19:43:36.9239560Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 04 May 2021 19:43:36 GMT + etag: + - W/"datetime'2021-05-04T19%3A43%3A36.9239560Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttablef69218ef(PartitionKey='pk2',RowKey='rk2') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:36 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:36 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablef69218ef(PartitionKey='pk2',RowKey='rk2') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 04 May 2021 19:43:36 GMT + server: + - Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:37 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:37 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablef69218ef() + response: + body: + string: '{"value":[],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttablef69218ef"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 04 May 2021 19:43:36 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: Ok +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Tue, 04 May 2021 19:43:37 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:37 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttablef69218ef') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 04 May 2021 19:43:37 GMT + server: + - Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:37 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:37 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"value":[],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 04 May 2021 19:43:37 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: Ok +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_delete_entity_overloads.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_delete_entity_overloads.yaml new file mode 100644 index 000000000000..51497bfdb4f9 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_delete_entity_overloads.yaml @@ -0,0 +1,230 @@ +interactions: +- request: + body: '{"TableName": "uttablede4a187e"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:37 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:37 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttablede4a187e","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 04 May 2021 19:43:38 GMT + etag: W/"datetime'2021-05-04T19%3A43%3A38.3982088Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttablede4a187e') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/Tables +- request: + body: '{"PartitionKey": "pkde4a187e", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rkde4a187e", "RowKey@odata.type": "Edm.String", "age": 39, "sex": + "male", "sex@odata.type": "Edm.String", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": 933311100, "Birthday": "1973-10-04T00:00:00.000000Z", + "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00.000000Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '591' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:38 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:38 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablede4a187e + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttablede4a187e/$metadata#uttablede4a187e/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A43%3A38.9327368Z''\"","PartitionKey":"pkde4a187e","RowKey":"rkde4a187e","age":39,"sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":933311100,"Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00.0000000Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00.0000000Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","Timestamp":"2021-05-04T19:43:38.9327368Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 04 May 2021 19:43:38 GMT + etag: W/"datetime'2021-05-04T19%3A43%3A38.9327368Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttablede4a187e(PartitionKey='pkde4a187e',RowKey='rkde4a187e') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttablede4a187e +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:38 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:38 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablede4a187e(PartitionKey='pkde4a187e',RowKey='rkde4a187e') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 04 May 2021 19:43:38 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/uttablede4a187e(PartitionKey='pkde4a187e',RowKey='rkde4a187e') +- request: + body: '{"PartitionKey": "pk2", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk2", "RowKey@odata.type": "Edm.String", "Value": 100}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '130' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:39 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:39 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablede4a187e + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttablede4a187e/$metadata#uttablede4a187e/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A43%3A39.2325640Z''\"","PartitionKey":"pk2","RowKey":"rk2","Value":100,"Timestamp":"2021-05-04T19:43:39.2325640Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 04 May 2021 19:43:38 GMT + etag: W/"datetime'2021-05-04T19%3A43%3A39.2325640Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttablede4a187e(PartitionKey='pk2',RowKey='rk2') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttablede4a187e +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:39 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:39 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablede4a187e(PartitionKey='pk2',RowKey='rk2') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 04 May 2021 19:43:38 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/uttablede4a187e(PartitionKey='pk2',RowKey='rk2') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:43:39 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:39 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablede4a187e() + response: + body: + string: '{"value":[],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttablede4a187e"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 04 May 2021 19:43:38 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/uttablede4a187e() +- request: + body: null + headers: + Accept: + - application/json + Date: + - Tue, 04 May 2021 19:43:39 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:43:39 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttablede4a187e') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 04 May 2021 19:43:39 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/Tables('uttablede4a187e') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_delete_entity_overloads_kwargs.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_delete_entity_overloads_kwargs.yaml new file mode 100644 index 000000000000..12325354ec12 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_delete_entity_overloads_kwargs.yaml @@ -0,0 +1,230 @@ +interactions: +- request: + body: '{"TableName": "uttable95541b6c"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:44:09 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:44:09 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable95541b6c","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 04 May 2021 19:44:10 GMT + etag: W/"datetime'2021-05-04T19%3A44%3A10.8103688Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable95541b6c') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/Tables +- request: + body: '{"PartitionKey": "pk95541b6c", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rk95541b6c", "RowKey@odata.type": "Edm.String", "age": 39, "sex": + "male", "sex@odata.type": "Edm.String", "married": true, "deceased": false, + "ratio": 3.1, "evenratio": 3.0, "large": 933311100, "Birthday": "1973-10-04T00:00:00.000000Z", + "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00.000000Z", + "birthday@odata.type": "Edm.DateTime", "binary": "YmluYXJ5", "binary@odata.type": + "Edm.Binary", "other": 20, "clsid": "c9da6455-213d-42c9-9a79-3e9149a57833", + "clsid@odata.type": "Edm.Guid"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '591' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:44:11 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:44:11 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable95541b6c + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable95541b6c/$metadata#uttable95541b6c/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A44%3A11.3381384Z''\"","PartitionKey":"pk95541b6c","RowKey":"rk95541b6c","age":39,"sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large":933311100,"Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00.0000000Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00.0000000Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","Timestamp":"2021-05-04T19:44:11.3381384Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 04 May 2021 19:44:10 GMT + etag: W/"datetime'2021-05-04T19%3A44%3A11.3381384Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable95541b6c(PartitionKey='pk95541b6c',RowKey='rk95541b6c') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable95541b6c +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:44:11 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:44:11 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable95541b6c(PartitionKey='pk95541b6c',RowKey='rk95541b6c') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 04 May 2021 19:44:10 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/uttable95541b6c(PartitionKey='pk95541b6c',RowKey='rk95541b6c') +- request: + body: '{"PartitionKey": "pk2", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk2", "RowKey@odata.type": "Edm.String", "Value": 100}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '130' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:44:11 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:44:11 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable95541b6c + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable95541b6c/$metadata#uttable95541b6c/@Element","odata.etag":"W/\"datetime''2021-05-04T19%3A44%3A11.5628040Z''\"","PartitionKey":"pk2","RowKey":"rk2","Value":100,"Timestamp":"2021-05-04T19:44:11.5628040Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 04 May 2021 19:44:10 GMT + etag: W/"datetime'2021-05-04T19%3A44%3A11.5628040Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable95541b6c(PartitionKey='pk2',RowKey='rk2') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable95541b6c +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:44:11 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:44:11 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable95541b6c(PartitionKey='pk2',RowKey='rk2') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 04 May 2021 19:44:10 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/uttable95541b6c(PartitionKey='pk2',RowKey='rk2') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 04 May 2021 19:44:11 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:44:11 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable95541b6c() + response: + body: + string: '{"value":[],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable95541b6c"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 04 May 2021 19:44:10 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/uttable95541b6c() +- request: + body: null + headers: + Accept: + - application/json + Date: + - Tue, 04 May 2021 19:44:11 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 04 May 2021 19:44:11 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable95541b6c') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 04 May 2021 19:44:12 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/Tables('uttable95541b6c') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/test_table_batch_async.py b/sdk/tables/azure-data-tables/tests/test_table_batch_async.py index 0e9505447067..924d94349759 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_batch_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_batch_async.py @@ -451,6 +451,7 @@ async def test_batch_delete(self, tables_storage_account_name, tables_primary_st with pytest.raises(ResourceNotFoundError): entity = await self.table.get_entity(partition_key=entity['PartitionKey'], row_key=entity['RowKey']) + finally: await self._tear_down() 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 ecee18445d37..2655bb9a662f 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_entity.py +++ b/sdk/tables/azure-data-tables/tests/test_table_entity.py @@ -907,8 +907,7 @@ def test_get_entity_if_match(self, tables_storage_account_name, tables_primary_s row_key=entity['RowKey']) self.table.delete_entity( - partition_key=resp['PartitionKey'], - row_key=resp['RowKey'], + {"PartitionKey": resp['PartitionKey'], "RowKey": resp['RowKey']}, etag=etag, match_condition=MatchConditions.IfNotModified ) @@ -1259,7 +1258,7 @@ def test_delete_entity_not_existing(self, tables_storage_account_name, tables_pr # Act with pytest.raises(ResourceNotFoundError): - self.table.delete_entity(entity['PartitionKey'], entity['RowKey']) + self.table.delete_entity({"PartitionKey": entity['PartitionKey'], "RowKey": entity['RowKey']}) # Assert finally: @@ -1295,12 +1294,69 @@ def test_delete_entity_with_if_doesnt_match(self, tables_storage_account_name, t self.table.delete_entity( entity['PartitionKey'], entity['RowKey'], etag=u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', - match_condition=MatchConditions.IfNotModified) + match_condition=MatchConditions.IfNotModified + ) # Assert finally: self._tear_down() + @TablesPreparer() + def test_delete_entity_overloads(self, tables_storage_account_name, tables_primary_storage_account_key): + # Arrange + self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + self.table.delete_entity(entity) + + pk, rk = self._create_pk_rk("pk", "rk") + pk, rk = pk + u"2", rk + u"2" + entity2 = { + u"PartitionKey": pk, + u"RowKey": rk, + u"Value": 100 + } + self.table.create_entity(entity2) + + self.table.delete_entity(pk, rk) + + count = 0 + for entity in self.table.list_entities(): + count += 1 + assert count == 0 + finally: + self._tear_down() + + @TablesPreparer() + def test_delete_entity_overloads_kwargs(self, tables_storage_account_name, tables_primary_storage_account_key): + # Arrange + self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + self.table.delete_entity(entity=entity) + + pk, rk = self._create_pk_rk("pk", "rk") + pk, rk = pk + u"2", rk + u"2" + entity2 = { + u"PartitionKey": pk, + u"RowKey": rk, + u"Value": 100 + } + self.table.create_entity(entity2) + + self.table.delete_entity(partition_key=pk, row_key=rk) + + count = 0 + for entity in self.table.list_entities(): + count += 1 + assert count == 0 + finally: + self._tear_down() + @TablesPreparer() def test_unicode_property_value(self, tables_storage_account_name, tables_primary_storage_account_key): # Arrange 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 80c71dc24583..06e848e76e15 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 @@ -636,8 +636,7 @@ async def test_get_entity_if_match(self, tables_storage_account_name, tables_pri row_key=entity['RowKey']) await self.table.delete_entity( - partition_key=resp['PartitionKey'], - row_key=resp['RowKey'], + {"PartitionKey": resp['PartitionKey'], "RowKey": resp['RowKey']}, etag=etag, match_condition=MatchConditions.IfNotModified ) @@ -990,7 +989,7 @@ async def test_delete_entity_not_existing(self, tables_storage_account_name, tab # Act with pytest.raises(ResourceNotFoundError): - await self.table.delete_entity(entity['PartitionKey'], entity['RowKey']) + await self.table.delete_entity({"PartitionKey": entity['PartitionKey'], "RowKey": entity['RowKey']}) # Assert finally: @@ -1004,8 +1003,12 @@ async def test_delete_entity_with_if_matches(self, tables_storage_account_name, entity, etag = await self._insert_random_entity() # Act - resp = await self.table.delete_entity(entity['PartitionKey'], entity['RowKey'], etag=etag, - match_condition=MatchConditions.IfNotModified) + resp = await self.table.delete_entity( + entity['PartitionKey'], + entity['RowKey'], + etag=etag, + match_condition=MatchConditions.IfNotModified + ) # Assert assert resp is None @@ -1025,14 +1028,72 @@ async def test_delete_entity_with_if_doesnt_match(self, tables_storage_account_n # Act with pytest.raises(HttpResponseError): await self.table.delete_entity( - entity['PartitionKey'], entity['RowKey'], + entity['PartitionKey'], + entity['RowKey'], etag=u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', - match_condition=MatchConditions.IfNotModified) + match_condition=MatchConditions.IfNotModified + ) # Assert finally: await self._tear_down() + @TablesPreparer() + async def test_delete_entity_overloads(self, tables_storage_account_name, tables_primary_storage_account_key): + # Arrange + await self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + await self.table.delete_entity(entity) + + pk, rk = self._create_pk_rk("pk", "rk") + pk, rk = pk + u"2", rk + u"2" + entity2 = { + u"PartitionKey": pk, + u"RowKey": rk, + u"Value": 100 + } + await self.table.create_entity(entity2) + + await self.table.delete_entity(pk, rk) + + count = 0 + async for entity in self.table.list_entities(): + count += 1 + assert count == 0 + finally: + await self._tear_down() + + @TablesPreparer() + async def test_delete_entity_overloads_kwargs(self, tables_storage_account_name, tables_primary_storage_account_key): + # Arrange + await self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Act + await self.table.delete_entity(entity=entity) + + pk, rk = self._create_pk_rk("pk", "rk") + pk, rk = pk + u"2", rk + u"2" + entity2 = { + u"PartitionKey": pk, + u"RowKey": rk, + u"Value": 100 + } + await self.table.create_entity(entity2) + + await self.table.delete_entity(partition_key=pk, row_key=rk) + + count = 0 + async for entity in self.table.list_entities(): + count += 1 + assert count == 0 + finally: + await self._tear_down() + @TablesPreparer() async def test_unicode_property_value(self, tables_storage_account_name, tables_primary_storage_account_key): ''' regression test for github issue #57''' diff --git a/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos.py b/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos.py index c1b22c73508d..6b482e34e63e 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos.py +++ b/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos.py @@ -865,8 +865,7 @@ def test_get_entity_if_match(self, tables_cosmos_account_name, tables_primary_co row_key=entity['RowKey']) self.table.delete_entity( - partition_key=resp['PartitionKey'], - row_key=resp['RowKey'], + {"PartitionKey": resp['PartitionKey'], "RowKey": resp['RowKey']}, etag=etag, match_condition=MatchConditions.IfNotModified ) @@ -1229,7 +1228,7 @@ def test_delete_entity_not_existing(self, tables_cosmos_account_name, tables_pri # Act with pytest.raises(ResourceNotFoundError): - self.table.delete_entity(entity['PartitionKey'], entity['RowKey']) + self.table.delete_entity({"PartitionKey": entity['PartitionKey'], "RowKey": entity['RowKey']}) # Assert finally: @@ -1268,15 +1267,73 @@ def test_delete_entity_with_if_doesnt_match(self, tables_cosmos_account_name, ta # Act with pytest.raises(HttpResponseError): self.table.delete_entity( - entity['PartitionKey'], entity['RowKey'], + entity['PartitionKey'], + entity['RowKey'], etag=u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', - match_condition=MatchConditions.IfNotModified) + match_condition=MatchConditions.IfNotModified + ) # Assert finally: self._tear_down() self.sleep(SLEEP_DELAY) + @CosmosPreparer() + def test_delete_entity_overloads(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): + # Arrange + self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + self.table.delete_entity(entity) + + pk, rk = self._create_pk_rk("pk", "rk") + pk, rk = pk + u"2", rk + u"2" + entity2 = { + u"PartitionKey": pk, + u"RowKey": rk, + u"Value": 100 + } + self.table.create_entity(entity2) + + self.table.delete_entity(pk, rk) + + count = 0 + for entity in self.table.list_entities(): + count += 1 + assert count == 0 + finally: + self._tear_down() + + @CosmosPreparer() + def test_delete_entity_overloads_kwargs(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): + # Arrange + self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + try: + entity, _ = self._insert_random_entity() + + # Act + self.table.delete_entity(entity=entity) + + pk, rk = self._create_pk_rk("pk", "rk") + pk, rk = pk + u"2", rk + u"2" + entity2 = { + u"PartitionKey": pk, + u"RowKey": rk, + u"Value": 100 + } + self.table.create_entity(entity2) + + self.table.delete_entity(partition_key=pk, row_key=rk) + + count = 0 + for entity in self.table.list_entities(): + count += 1 + assert count == 0 + finally: + self._tear_down() + @CosmosPreparer() def test_unicode_property_value(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange diff --git a/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos_async.py b/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos_async.py index 106ce07d322b..70723b4f5acd 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos_async.py @@ -602,8 +602,7 @@ async def test_get_entity_if_match(self, tables_cosmos_account_name, tables_prim row_key=entity['RowKey']) await self.table.delete_entity( - partition_key=resp['PartitionKey'], - row_key=resp['RowKey'], + {"PartitionKey": resp['PartitionKey'], "RowKey": resp['RowKey']}, etag=etag, match_condition=MatchConditions.IfNotModified ) @@ -926,7 +925,6 @@ async def test_delete_entity(self, tables_cosmos_account_name, tables_primary_co try: entity, _ = await self._insert_random_entity() - # Act await self.table.delete_entity(partition_key=entity['PartitionKey'], row_key=entity['RowKey']) with pytest.raises(ResourceNotFoundError): @@ -943,7 +941,7 @@ async def test_delete_entity_not_existing(self, tables_cosmos_account_name, tabl # Act with pytest.raises(ResourceNotFoundError): - await self.table.delete_entity(entity['PartitionKey'], entity['RowKey']) + await self.table.delete_entity({"PartitionKey": entity['PartitionKey'], "RowKey": entity['RowKey']}) # Assert finally: @@ -956,9 +954,12 @@ async def test_delete_entity_with_if_matches(self, tables_cosmos_account_name, t try: entity, etag = await self._insert_random_entity() - # Act - await self.table.delete_entity(entity['PartitionKey'], entity['RowKey'], etag=etag, - match_condition=MatchConditions.IfNotModified) + await self.table.delete_entity( + entity['PartitionKey'], + entity['RowKey'], + etag=etag, + match_condition=MatchConditions.IfNotModified + ) with pytest.raises(ResourceNotFoundError): await self.table.get_entity(entity['PartitionKey'], entity['RowKey']) @@ -976,11 +977,69 @@ async def test_delete_entity_with_if_doesnt_match(self, tables_cosmos_account_na # Act with pytest.raises(HttpResponseError): await self.table.delete_entity( - entity['PartitionKey'], entity['RowKey'], + entity['PartitionKey'], + entity['RowKey'], etag=u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"', - match_condition=MatchConditions.IfNotModified) + match_condition=MatchConditions.IfNotModified + ) + finally: + await self._tear_down() - # Assert + @CosmosPreparer() + async def test_delete_entity_overloads(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): + # Arrange + await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Test passing in an entity + await self.table.delete_entity(entity) + + pk, rk = self._create_pk_rk("pk", "rk") + pk, rk = pk + u"2", rk + u"2" + entity2 = { + u"PartitionKey": pk, + u"RowKey": rk, + u"Value": 100 + } + await self.table.create_entity(entity2) + + # Test passing in a partition key and row key + await self.table.delete_entity(pk, rk) + + count = 0 + async for entity in self.table.list_entities(): + count += 1 + assert count == 0 + finally: + await self._tear_down() + + @CosmosPreparer() + async def test_delete_entity_overloads_kwargs(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): + # Arrange + await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + try: + entity, _ = await self._insert_random_entity() + + # Test passing in an entity + await self.table.delete_entity(entity=entity) + + pk, rk = self._create_pk_rk("pk", "rk") + pk, rk = pk + u"2", rk + u"2" + entity2 = { + u"PartitionKey": pk, + u"RowKey": rk, + u"Value": 100 + } + await self.table.create_entity(entity2) + + # Test passing in a partition key and row key + await self.table.delete_entity(partition_key=pk, row_key=rk) + + count = 0 + async for entity in self.table.list_entities(): + count += 1 + assert count == 0 finally: await self._tear_down() @@ -1047,7 +1106,6 @@ async def test_operations_on_entity_with_partition_key_having_single_quote(self, try: entity, _ = await self._insert_random_entity(pk=partition_key_with_single_quote, rk=row_key_with_single_quote) - # Act sent_entity = self._create_updated_entity_dict(entity['PartitionKey'], entity['RowKey']) await self.table.upsert_entity(mode=UpdateMode.REPLACE, entity=sent_entity) @@ -1055,7 +1113,6 @@ async def test_operations_on_entity_with_partition_key_having_single_quote(self, received_entity = await self.table.get_entity(entity['PartitionKey'], entity['RowKey']) self._assert_updated_entity(received_entity) - # Act sent_entity['newField'] = 'newFieldValue' await self.table.update_entity(mode=UpdateMode.REPLACE, entity=sent_entity) @@ -1063,7 +1120,6 @@ async def test_operations_on_entity_with_partition_key_having_single_quote(self, self._assert_updated_entity(received_entity) assert received_entity['newField'] == 'newFieldValue' - # Act await self.table.delete_entity(entity['PartitionKey'], entity['RowKey']) finally: await self._tear_down()