From 06cb30634c26e50a7fc4d00cbb87b514a459e582 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Fri, 23 Apr 2021 15:24:56 -0400 Subject: [PATCH 1/5] use etag from entity if match condition is given --- .../azure/data/tables/_table_batch.py | 19 +++++++++++++++---- .../azure/data/tables/_table_client.py | 12 ++++++++++-- .../data/tables/aio/_table_batch_async.py | 18 ++++++++++++++---- .../data/tables/aio/_table_client_async.py | 18 ++++++++++++++---- 4 files changed, 53 insertions(+), 14 deletions(-) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py index 017ff00ba7c1..62a0343fafe1 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py @@ -228,11 +228,16 @@ def update_entity( self._verify_partition_key(entity) temp = entity.copy() + match_condition = kwargs.pop("match_condition", None) + etag = kwargs.pop("etag", None) + if match_condition: + etag = entity.metadata["etag"] + if_match, _ = _get_match_headers( kwargs=dict( kwargs, - etag=kwargs.pop("etag", None), - match_condition=kwargs.pop("match_condition", None), + etag=etag, + match_condition=match_condition, ), etag_param="etag", match_param="match_condition", @@ -510,16 +515,22 @@ def delete_entity( else: self._partition_key = partition_key + match_condition = kwargs.pop("match_condition", None) + etag = kwargs.pop("etag", None) + # if match_condition: + # etag = entity.metadata["etag"] + if_match, _ = _get_match_headers( kwargs=dict( kwargs, - etag=kwargs.pop("etag", None), - match_condition=kwargs.pop("match_condition", None), + etag=etag, + match_condition=match_condition, ), etag_param="etag", match_param="match_condition", ) + self._batch_delete_entity( table=self.table_name, partition_key=partition_key, 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 02f37a2f056e..337d49422e9a 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 @@ -293,6 +293,10 @@ def delete_entity( :dedent: 8 :caption: Deleting an entity to a Table """ + # match_condition = kwargs.pop("match_condition", None) + # etag = kwargs.pop("etag", None) + # if match_condition: + # etag = entity.metadata["etag"] if_match, _ = _get_match_headers( kwargs=dict( @@ -385,12 +389,16 @@ def update_entity( :dedent: 8 :caption: Updating an already exiting entity in a Table """ + match_condition = kwargs.pop("match_condition", None) + etag = kwargs.pop("etag", None) + if match_condition: + etag = entity.metadata["etag"] if_match, _ = _get_match_headers( kwargs=dict( kwargs, - etag=kwargs.pop("etag", None), - match_condition=kwargs.pop("match_condition", None), + etag=etag, + match_condition=match_condition, ), etag_param="etag", match_param="match_condition", diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py index 8fd66c4ac148..e1a4868f0def 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py @@ -217,11 +217,16 @@ def update_entity( self._verify_partition_key(entity) temp = entity.copy() + match_condition = kwargs.pop("match_condition", None) + etag = kwargs.pop("etag", None) + if match_condition: + etag = entity.metadata["etag"] + if_match, _ = _get_match_headers( kwargs=dict( kwargs, - etag=kwargs.pop("etag", None), - match_condition=kwargs.pop("match_condition", None), + etag=etag, + match_condition=match_condition, ), etag_param="etag", match_param="match_condition", @@ -501,11 +506,16 @@ def delete_entity( else: self._partition_key = partition_key + match_condition = kwargs.pop("match_condition", None) + etag = kwargs.pop("etag", None) + if match_condition: + etag = entity.metadata["etag"] + if_match, _ = _get_match_headers( kwargs=dict( kwargs, - etag=kwargs.pop("etag", None), - match_condition=kwargs.pop("match_condition", None), + etag=etag, + match_condition=match_condition, ), etag_param="etag", match_param="match_condition", 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 6fb1345900e6..52a988397395 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 @@ -304,11 +304,16 @@ async def delete_entity( :dedent: 8 :caption: Adding an entity to a Table """ + match_condition = kwargs.pop("match_condition", None) + etag = kwargs.pop("etag", None) + # if match_condition: + # etag = entity.metadata["etag"] + if_match, _ = _get_match_headers( kwargs=dict( kwargs, - etag=kwargs.pop("etag", None), - match_condition=kwargs.pop("match_condition", None), + etag=etag, + match_condition=match_condition, ), etag_param="etag", match_param="match_condition", @@ -394,11 +399,16 @@ async def update_entity( :dedent: 8 :caption: Querying entities from a TableClient """ + match_condition = kwargs.pop("match_condition", None) + etag = kwargs.pop("etag", None) + if match_condition: + etag = entity.metadata["etag"] + if_match, _ = _get_match_headers( kwargs=dict( kwargs, - etag=kwargs.pop("etag", None), - match_condition=kwargs.pop("match_condition", None), + etag=etag, + match_condition=match_condition, ), etag_param="etag", match_param="match_condition", From 83ff9f9b5a2658250303985f46420bec0722bd54 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Wed, 5 May 2021 12:27:30 -0400 Subject: [PATCH 2/5] added tests, fixed another one, updated changelog --- sdk/tables/azure-data-tables/CHANGELOG.md | 1 + .../azure/data/tables/_table_batch.py | 10 +- .../azure/data/tables/_table_client.py | 6 +- .../data/tables/aio/_table_batch_async.py | 10 +- .../data/tables/aio/_table_client_async.py | 5 +- ...table_entity.test_get_entity_if_match.yaml | 71 ++-- ...t_get_entity_if_match_entity_bad_etag.yaml | 337 ++++++++++++++++++ ...entity_async.test_get_entity_if_match.yaml | 94 +++-- ...t_get_entity_if_match_entity_bad_etag.yaml | 259 ++++++++++++++ ...ntity_cosmos.test_get_entity_if_match.yaml | 109 ++++-- ...t_get_entity_if_match_entity_bad_etag.yaml | 337 ++++++++++++++++++ ...cosmos_async.test_get_entity_if_match.yaml | 94 +++-- ...t_get_entity_if_match_entity_bad_etag.yaml | 243 +++++++++++++ .../tests/test_table_entity.py | 41 ++- .../tests/test_table_entity_async.py | 41 ++- .../tests/test_table_entity_cosmos.py | 41 ++- .../tests/test_table_entity_cosmos_async.py | 39 +- 17 files changed, 1572 insertions(+), 166 deletions(-) create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match_entity_bad_etag.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_if_match_entity_bad_etag.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_get_entity_if_match_entity_bad_etag.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_get_entity_if_match_entity_bad_etag.yaml diff --git a/sdk/tables/azure-data-tables/CHANGELOG.md b/sdk/tables/azure-data-tables/CHANGELOG.md index 8f69a1d3a20f..19d3c49c75aa 100644 --- a/sdk/tables/azure-data-tables/CHANGELOG.md +++ b/sdk/tables/azure-data-tables/CHANGELOG.md @@ -26,6 +26,7 @@ * Added support for Azurite storage emulator * Throws a `RequestTooLargeError` on transaction requests that return a 413 error code * Added support for Int64 and Binary types in query filters +* On `update_entity` and `delete_entity` if no `etag` is supplied via kwargs, the `etag` in the entity will be used if it is in the entity. ## 12.0.0b6 (2021-04-06) * Updated deserialization of datetime fields in entities to support preservation of the service format with additional decimal place. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py index 43300a26940d..886c420bab71 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py @@ -241,7 +241,10 @@ def update( match_condition = kwargs.pop("match_condition", None) etag = kwargs.pop("etag", None) if match_condition and not etag: - etag = entity.metadata.get("etag", None) + try: + etag = entity.metadata.get("etag", None) + except AttributeError: + pass if_match, _ = _get_match_headers( kwargs=dict( @@ -524,7 +527,10 @@ def delete( match_condition = kwargs.pop("match_condition", None) etag = kwargs.pop("etag", None) if match_condition and not etag: - etag = entity.metadata.get("etag", None) + try: + etag = entity.metadata.get("etag", None) + except AttributeError: + pass if_match, _ = _get_match_headers( kwargs=dict( 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 5376f32749c2..efbfebdadbef 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 @@ -325,8 +325,10 @@ def delete_entity(self, *args, **kwargs): match_condition = kwargs.pop("match_condition", None) etag = kwargs.pop("etag", None) if match_condition and entity and not etag: - etag = entity.metadata.get("etag", None) - + try: + etag = entity.metadata.get("etag", None) + except AttributeError: + pass if_match, _ = _get_match_headers( kwargs=dict( diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py index 6a67cdf59b34..5eabfa4a061d 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py @@ -217,7 +217,10 @@ def update( match_condition = kwargs.pop("match_condition", None) etag = kwargs.pop("etag", None) if match_condition and not etag: - etag = entity.metadata.get("etag", None) + try: + etag = entity.metadata.get("etag", None) + except AttributeError: + pass if_match, _ = _get_match_headers( kwargs=dict( @@ -493,7 +496,10 @@ def delete( match_condition = kwargs.pop("match_condition", None) etag = kwargs.pop("etag", None) if match_condition and not etag: - etag = entity.metadata.get("etag", None) + try: + etag = entity.metadata.get("etag", None) + except AttributeError: + pass 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 11ad46049f44..3500fe4d4725 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 @@ -313,7 +313,10 @@ async def delete_entity(self, *args: Union[TableEntity, str], **kwargs: Any) -> match_condition = kwargs.pop("match_condition", None) etag = kwargs.pop("etag", None) if match_condition and entity and not etag: - etag = entity.metadata.get("etag", None) + try: + etag = entity.metadata.get("etag", None) + except AttributeError: + pass if_match, _ = _get_match_headers( kwargs=dict( diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match.yaml index d08310b3f150..3d72007589b2 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match.yaml @@ -15,11 +15,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 17:08:59 GMT + - Wed, 05 May 2021 16:24:20 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 17:08:59 GMT + - Wed, 05 May 2021 16:24:20 GMT x-ms-version: - '2019-02-02' method: POST @@ -33,7 +33,7 @@ interactions: content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:21 GMT location: - https://fake_table_account.table.core.windows.net/Tables('uttable74691147') server: @@ -51,10 +51,11 @@ interactions: body: '{"PartitionKey": "pk74691147", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk74691147", "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:00Z", - "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", "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"}' + "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 @@ -63,33 +64,33 @@ interactions: Connection: - keep-alive Content-Length: - - '577' + - '591' Content-Type: - application/json;odata=nometadata DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:21 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:21 GMT x-ms-version: - '2019-02-02' method: POST uri: https://fake_table_account.table.core.windows.net/uttable74691147 response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable74691147/@Element","odata.etag":"W/\"datetime''2020-12-18T17%3A09%3A00.8060527Z''\"","PartitionKey":"pk74691147","RowKey":"rk74691147","Timestamp":"2020-12-18T17:09:00.8060527Z","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"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable74691147/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A24%3A21.9083855Z''\"","PartitionKey":"pk74691147","RowKey":"rk74691147","Timestamp":"2021-05-05T16:24:21.9083855Z","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: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:21 GMT etag: - - W/"datetime'2020-12-18T17%3A09%3A00.8060527Z'" + - W/"datetime'2021-05-05T16%3A24%3A21.9083855Z'" location: - https://fake_table_account.table.core.windows.net/uttable74691147(PartitionKey='pk74691147',RowKey='rk74691147') server: @@ -115,27 +116,27 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:21 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:21 GMT x-ms-version: - '2019-02-02' method: GET uri: https://fake_table_account.table.core.windows.net/uttable74691147(PartitionKey='pk74691147',RowKey='rk74691147') response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable74691147/@Element","odata.etag":"W/\"datetime''2020-12-18T17%3A09%3A00.8060527Z''\"","PartitionKey":"pk74691147","RowKey":"rk74691147","Timestamp":"2020-12-18T17:09:00.8060527Z","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"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable74691147/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A24%3A21.9083855Z''\"","PartitionKey":"pk74691147","RowKey":"rk74691147","Timestamp":"2021-05-05T16:24:21.9083855Z","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: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:21 GMT etag: - - W/"datetime'2020-12-18T17%3A09%3A00.8060527Z'" + - W/"datetime'2021-05-05T16%3A24%3A21.9083855Z'" server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -161,13 +162,13 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:21 GMT If-Match: - - W/"datetime'2020-12-18T17%3A09%3A00.8060527Z'" + - W/"datetime'2021-05-05T16%3A24%3A21.9083855Z'" User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:21 GMT x-ms-version: - '2019-02-02' method: DELETE @@ -181,7 +182,7 @@ interactions: content-length: - '0' date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:21 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 x-content-type-options: @@ -203,11 +204,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:22 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:22 GMT x-ms-version: - '2019-02-02' method: GET @@ -215,14 +216,14 @@ interactions: response: body: string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The - specified resource does not exist.\nRequestId:c5dae71c-e002-002b-6960-d523d5000000\nTime:2020-12-18T17:09:01.2073392Z"}}}' + specified resource does not exist.\nRequestId:6139d8f0-a002-0067-4ecb-41cad8000000\nTime:2021-05-05T16:24:22.3567036Z"}}}' headers: cache-control: - no-cache content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:22 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -246,11 +247,11 @@ interactions: Content-Length: - '0' Date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:22 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:22 GMT x-ms-version: - '2019-02-02' method: DELETE @@ -264,7 +265,7 @@ interactions: content-length: - '0' date: - - Fri, 18 Dec 2020 17:09:00 GMT + - Wed, 05 May 2021 16:24:22 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 x-content-type-options: diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match_entity_bad_etag.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match_entity_bad_etag.yaml new file mode 100644 index 000000000000..4f986c714f51 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_get_entity_if_match_entity_bad_etag.yaml @@ -0,0 +1,337 @@ +interactions: +- request: + body: '{"TableName": "uttablec0a717c9"}' + 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: + - Wed, 05 May 2021 16:24:22 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:22 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":"uttablec0a717c9"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Wed, 05 May 2021 16:24:22 GMT + location: + - https://fake_table_account.table.core.windows.net/Tables('uttablec0a717c9') + 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": "pkc0a717c9", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rkc0a717c9", "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: + - Wed, 05 May 2021 16:24:23 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:23 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttablec0a717c9 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttablec0a717c9/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A24%3A23.3510055Z''\"","PartitionKey":"pkc0a717c9","RowKey":"rkc0a717c9","Timestamp":"2021-05-05T16:24:23.3510055Z","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: + - Wed, 05 May 2021 16:24:22 GMT + etag: + - W/"datetime'2021-05-05T16%3A24%3A23.3510055Z'" + location: + - https://fake_table_account.table.core.windows.net/uttablec0a717c9(PartitionKey='pkc0a717c9',RowKey='rkc0a717c9') + 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": "pkc0a717c9", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rkc0a717c9", "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", "value": 10}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '604' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:24:23 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: + - Wed, 05 May 2021 16:24:23 GMT + x-ms-version: + - '2019-02-02' + method: PATCH + uri: https://fake_table_account.table.core.windows.net/uttablec0a717c9(PartitionKey='pkc0a717c9',RowKey='rkc0a717c9') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 05 May 2021 16:24:22 GMT + etag: + - W/"datetime'2021-05-05T16%3A24%3A23.5411106Z'" + 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: + - Wed, 05 May 2021 16:24:23 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:23 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttablec0a717c9(PartitionKey='pkc0a717c9',RowKey='rkc0a717c9') + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttablec0a717c9/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A24%3A23.5411106Z''\"","PartitionKey":"pkc0a717c9","RowKey":"rkc0a717c9","Timestamp":"2021-05-05T16:24:23.5411106Z","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","age":39,"binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","deceased":false,"evenratio":3.0,"large":933311100,"married":true,"other":20,"ratio":3.1,"sex":"male","value":10}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Wed, 05 May 2021 16:24:22 GMT + etag: + - W/"datetime'2021-05-05T16%3A24%3A23.5411106Z'" + 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;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:24:23 GMT + If-Match: + - W/"datetime'2021-05-05T16%3A24%3A23.3510055Z'" + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:23 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttablec0a717c9(PartitionKey='pkc0a717c9',RowKey='rkc0a717c9') + response: + body: + string: '{"odata.error":{"code":"UpdateConditionNotSatisfied","message":{"lang":"en-US","value":"The + update condition specified in the request was not satisfied.\nRequestId:68a8783d-b002-008f-13cb-41534e000000\nTime:2021-05-05T16:24:23.9484302Z"}}}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Wed, 05 May 2021 16:24:23 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: 412 + message: Precondition Failed +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:24:23 GMT + If-Match: + - W/"datetime'2021-05-05T16%3A24%3A23.5411106Z'" + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:23 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttablec0a717c9(PartitionKey='pkc0a717c9',RowKey='rkc0a717c9') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 05 May 2021 16:24:23 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 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Wed, 05 May 2021 16:24:24 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:24 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttablec0a717c9') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 05 May 2021 16:24:23 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_get_entity_if_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_if_match.yaml index 4140a3764e0b..a5fb139866b1 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_if_match.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_if_match.yaml @@ -11,11 +11,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 17:10:09 GMT + - Wed, 05 May 2021 16:24:24 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 17:10:09 GMT + - Wed, 05 May 2021 16:24:24 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, 18 Dec 2020 17:10:09 GMT + date: Wed, 05 May 2021 16:24:24 GMT location: https://fake_table_account.table.core.windows.net/Tables('uttablee60b13c4') server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked @@ -40,37 +40,38 @@ interactions: body: '{"PartitionKey": "pke60b13c4", "PartitionKey@odata.type": "Edm.String", "RowKey": "rke60b13c4", "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:00Z", - "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", "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"}' + "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: - - '577' + - '591' Content-Type: - application/json;odata=nometadata DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 17:10:10 GMT + - Wed, 05 May 2021 16:24:24 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 17:10:10 GMT + - Wed, 05 May 2021 16:24:24 GMT x-ms-version: - '2019-02-02' method: POST uri: https://fake_table_account.table.core.windows.net/uttablee60b13c4 response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttablee60b13c4/@Element","odata.etag":"W/\"datetime''2020-12-18T17%3A10%3A10.6145308Z''\"","PartitionKey":"pke60b13c4","RowKey":"rke60b13c4","Timestamp":"2020-12-18T17:10:10.6145308Z","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"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttablee60b13c4/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A24%3A25.1416237Z''\"","PartitionKey":"pke60b13c4","RowKey":"rke60b13c4","Timestamp":"2021-05-05T16:24:25.1416237Z","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: Fri, 18 Dec 2020 17:10:10 GMT - etag: W/"datetime'2020-12-18T17%3A10%3A10.6145308Z'" + date: Wed, 05 May 2021 16:24:24 GMT + etag: W/"datetime'2021-05-05T16%3A24%3A25.1416237Z'" location: https://fake_table_account.table.core.windows.net/uttablee60b13c4(PartitionKey='pke60b13c4',RowKey='rke60b13c4') server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked @@ -88,23 +89,23 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 17:10:10 GMT + - Wed, 05 May 2021 16:24:25 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 17:10:10 GMT + - Wed, 05 May 2021 16:24:25 GMT x-ms-version: - '2019-02-02' method: GET uri: https://fake_table_account.table.core.windows.net/uttablee60b13c4(PartitionKey='pke60b13c4',RowKey='rke60b13c4') response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttablee60b13c4/@Element","odata.etag":"W/\"datetime''2020-12-18T17%3A10%3A10.6145308Z''\"","PartitionKey":"pke60b13c4","RowKey":"rke60b13c4","Timestamp":"2020-12-18T17:10:10.6145308Z","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"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttablee60b13c4/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A24%3A25.1416237Z''\"","PartitionKey":"pke60b13c4","RowKey":"rke60b13c4","Timestamp":"2021-05-05T16:24:25.1416237Z","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: Fri, 18 Dec 2020 17:10:10 GMT - etag: W/"datetime'2020-12-18T17%3A10%3A10.6145308Z'" + date: Wed, 05 May 2021 16:24:24 GMT + etag: W/"datetime'2021-05-05T16%3A24%3A25.1416237Z'" server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked x-content-type-options: nosniff @@ -121,13 +122,13 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 17:10:10 GMT + - Wed, 05 May 2021 16:24:25 GMT If-Match: - - W/"datetime'2020-12-18T17%3A10%3A10.6145308Z'" + - W/"datetime'2021-05-05T16%3A24%3A25.1416237Z'" User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 17:10:10 GMT + - Wed, 05 May 2021 16:24:25 GMT x-ms-version: - '2019-02-02' method: DELETE @@ -138,7 +139,7 @@ interactions: headers: cache-control: no-cache content-length: '0' - date: Fri, 18 Dec 2020 17:10:10 GMT + date: Wed, 05 May 2021 16:24:24 GMT server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 x-content-type-options: nosniff x-ms-version: '2019-02-02' @@ -146,17 +147,50 @@ interactions: code: 204 message: No Content url: https://seankaneprim.table.core.windows.net/uttablee60b13c4(PartitionKey='pke60b13c4',RowKey='rke60b13c4') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:24:25 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:25 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttablee60b13c4(PartitionKey='pke60b13c4',RowKey='rke60b13c4') + response: + body: + string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:ad88b967-e002-0082-32cb-419b9a000000\nTime:2021-05-05T16:24:25.4988783Z"}}}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 05 May 2021 16:24:25 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: 404 + message: Not Found + url: https://seankaneprim.table.core.windows.net/uttablee60b13c4(PartitionKey='pke60b13c4',RowKey='rke60b13c4') - request: body: null headers: Accept: - application/json Date: - - Fri, 18 Dec 2020 17:10:10 GMT + - Wed, 05 May 2021 16:24:25 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 17:10:10 GMT + - Wed, 05 May 2021 16:24:25 GMT x-ms-version: - '2019-02-02' method: DELETE @@ -167,7 +201,7 @@ interactions: headers: cache-control: no-cache content-length: '0' - date: Fri, 18 Dec 2020 17:10:10 GMT + date: Wed, 05 May 2021 16:24:25 GMT server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 x-content-type-options: nosniff x-ms-version: '2019-02-02' diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_if_match_entity_bad_etag.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_if_match_entity_bad_etag.yaml new file mode 100644 index 000000000000..33a9dd808733 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_async.test_get_entity_if_match_entity_bad_etag.yaml @@ -0,0 +1,259 @@ +interactions: +- request: + body: '{"TableName": "uttable5a281a46"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:24:25 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:25 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":"uttable5a281a46"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 05 May 2021 16:24:25 GMT + location: https://fake_table_account.table.core.windows.net/Tables('uttable5a281a46') + 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": "pk5a281a46", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rk5a281a46", "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: + - Wed, 05 May 2021 16:24:26 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:26 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttable5a281a46 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable5a281a46/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A24%3A26.2907826Z''\"","PartitionKey":"pk5a281a46","RowKey":"rk5a281a46","Timestamp":"2021-05-05T16:24:26.2907826Z","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: Wed, 05 May 2021 16:24:25 GMT + etag: W/"datetime'2021-05-05T16%3A24%3A26.2907826Z'" + location: https://fake_table_account.table.core.windows.net/uttable5a281a46(PartitionKey='pk5a281a46',RowKey='rk5a281a46') + 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/uttable5a281a46 +- request: + body: '{"PartitionKey": "pk5a281a46", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rk5a281a46", "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", "value": 10}' + headers: + Accept: + - application/json + Content-Length: + - '604' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:24:26 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: + - Wed, 05 May 2021 16:24:26 GMT + x-ms-version: + - '2019-02-02' + method: PATCH + uri: https://fake_table_account.table.core.windows.net/uttable5a281a46(PartitionKey='pk5a281a46',RowKey='rk5a281a46') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Wed, 05 May 2021 16:24:25 GMT + etag: W/"datetime'2021-05-05T16%3A24%3A26.4201528Z'" + 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/uttable5a281a46(PartitionKey='pk5a281a46',RowKey='rk5a281a46') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:24:26 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:26 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttable5a281a46(PartitionKey='pk5a281a46',RowKey='rk5a281a46') + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable5a281a46/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A24%3A26.4201528Z''\"","PartitionKey":"pk5a281a46","RowKey":"rk5a281a46","Timestamp":"2021-05-05T16:24:26.4201528Z","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","age":39,"binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833","deceased":false,"evenratio":3.0,"large":933311100,"married":true,"other":20,"ratio":3.1,"sex":"male","value":10}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 05 May 2021 16:24:25 GMT + etag: W/"datetime'2021-05-05T16%3A24%3A26.4201528Z'" + 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/uttable5a281a46(PartitionKey='pk5a281a46',RowKey='rk5a281a46') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:24:26 GMT + If-Match: + - W/"datetime'2021-05-05T16%3A24%3A26.2907826Z'" + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:26 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttable5a281a46(PartitionKey='pk5a281a46',RowKey='rk5a281a46') + response: + body: + string: '{"odata.error":{"code":"UpdateConditionNotSatisfied","message":{"lang":"en-US","value":"The + update condition specified in the request was not satisfied.\nRequestId:d810e24d-1002-0096-5acb-41d3f5000000\nTime:2021-05-05T16:24:26.6660521Z"}}}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 05 May 2021 16:24:25 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: 412 + message: Precondition Failed + url: https://seankaneprim.table.core.windows.net/uttable5a281a46(PartitionKey='pk5a281a46',RowKey='rk5a281a46') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:24:26 GMT + If-Match: + - W/"datetime'2021-05-05T16%3A24%3A26.4201528Z'" + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:26 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttable5a281a46(PartitionKey='pk5a281a46',RowKey='rk5a281a46') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Wed, 05 May 2021 16:24:25 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/uttable5a281a46(PartitionKey='pk5a281a46',RowKey='rk5a281a46') +- request: + body: null + headers: + Accept: + - application/json + Date: + - Wed, 05 May 2021 16:24:26 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:26 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttable5a281a46') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Wed, 05 May 2021 16:24:25 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('uttable5a281a46') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_get_entity_if_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_get_entity_if_match.yaml index 2c9f9239df60..8de633ecfed3 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_get_entity_if_match.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_get_entity_if_match.yaml @@ -15,11 +15,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 16:16:34 GMT + - Wed, 05 May 2021 16:24:26 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 16:16:34 GMT + - Wed, 05 May 2021 16:24:26 GMT x-ms-version: - '2019-02-02' method: POST @@ -31,9 +31,9 @@ interactions: content-type: - application/json;odata=minimalmetadata date: - - Fri, 18 Dec 2020 16:16:35 GMT + - Wed, 05 May 2021 16:24:27 GMT etag: - - W/"datetime'2020-12-18T16%3A16%3A35.8857736Z'" + - W/"datetime'2021-05-05T16%3A24%3A28.2543112Z'" location: - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttablefb9a143a') server: @@ -47,10 +47,11 @@ interactions: body: '{"PartitionKey": "pkfb9a143a", "PartitionKey@odata.type": "Edm.String", "RowKey": "rkfb9a143a", "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:00Z", - "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", "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"}' + "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 @@ -59,31 +60,31 @@ interactions: Connection: - keep-alive Content-Length: - - '577' + - '591' Content-Type: - application/json;odata=nometadata DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:28 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:28 GMT x-ms-version: - '2019-02-02' method: POST uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablefb9a143a response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttablefb9a143a/$metadata#uttablefb9a143a/@Element","odata.etag":"W/\"datetime''2020-12-18T16%3A16%3A36.6765064Z''\"","PartitionKey":"pkfb9a143a","RowKey":"rkfb9a143a","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":"2020-12-18T16:16:36.6765064Z"}' + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttablefb9a143a/$metadata#uttablefb9a143a/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A24%3A28.8490504Z''\"","PartitionKey":"pkfb9a143a","RowKey":"rkfb9a143a","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-05T16:24:28.8490504Z"}' headers: content-type: - application/json;odata=minimalmetadata date: - - Fri, 18 Dec 2020 16:16:35 GMT + - Wed, 05 May 2021 16:24:28 GMT etag: - - W/"datetime'2020-12-18T16%3A16%3A36.6765064Z'" + - W/"datetime'2021-05-05T16%3A24%3A28.8490504Z'" location: - https://fake_cosmos_account.table.cosmos.azure.com/uttablefb9a143a(PartitionKey='pkfb9a143a',RowKey='rkfb9a143a') server: @@ -105,25 +106,25 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:28 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:28 GMT x-ms-version: - '2019-02-02' method: GET uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablefb9a143a(PartitionKey='pkfb9a143a',RowKey='rkfb9a143a') response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttablefb9a143a/$metadata#uttablefb9a143a/@Element","odata.etag":"W/\"datetime''2020-12-18T16%3A16%3A36.6765064Z''\"","PartitionKey":"pkfb9a143a","RowKey":"rkfb9a143a","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":"2020-12-18T16:16:36.6765064Z"}' + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttablefb9a143a/$metadata#uttablefb9a143a/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A24%3A28.8490504Z''\"","PartitionKey":"pkfb9a143a","RowKey":"rkfb9a143a","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-05T16:24:28.8490504Z"}' headers: content-type: - application/json;odata=minimalmetadata date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:28 GMT etag: - - W/"datetime'2020-12-18T16%3A16%3A36.6765064Z'" + - W/"datetime'2021-05-05T16%3A24%3A28.8490504Z'" server: - Microsoft-HTTPAPI/2.0 transfer-encoding: @@ -145,13 +146,13 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:28 GMT If-Match: - - W/"datetime'2020-12-18T16%3A16%3A36.6765064Z'" + - W/"datetime'2021-05-05T16%3A24%3A28.8490504Z'" User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:28 GMT x-ms-version: - '2019-02-02' method: DELETE @@ -163,12 +164,50 @@ interactions: content-length: - '0' date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:28 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: + - Wed, 05 May 2021 16:24:29 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:24:29 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablefb9a143a(PartitionKey='pkfb9a143a',RowKey='rkfb9a143a') + response: + body: + string: "{\"odata.error\":{\"code\":\"ResourceNotFound\",\"message\":{\"lang\"\ + :\"en-us\",\"value\":\"The specified resource does not exist.\\nRequestID:5da68309-adbe-11eb-b79c-002b67128e4c\\\ + n\"}}}\r\n" + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Wed, 05 May 2021 16:24:28 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 404 + message: Not Found - request: body: null headers: @@ -181,11 +220,11 @@ interactions: Content-Length: - '0' Date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:29 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:29 GMT x-ms-version: - '2019-02-02' method: DELETE @@ -197,7 +236,7 @@ interactions: content-length: - '0' date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:29 GMT server: - Microsoft-HTTPAPI/2.0 status: @@ -215,11 +254,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:29 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:29 GMT x-ms-version: - '2019-02-02' method: GET @@ -231,7 +270,7 @@ interactions: content-type: - application/json;odata=minimalmetadata date: - - Fri, 18 Dec 2020 16:16:36 GMT + - Wed, 05 May 2021 16:24:29 GMT server: - Microsoft-HTTPAPI/2.0 transfer-encoding: diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_get_entity_if_match_entity_bad_etag.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_get_entity_if_match_entity_bad_etag.yaml new file mode 100644 index 000000000000..dcbc7c402f0e --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_get_entity_if_match_entity_bad_etag.yaml @@ -0,0 +1,337 @@ +interactions: +- request: + body: '{"TableName": "uttable77171abc"}' + 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: + - Wed, 05 May 2021 16:25:00 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:00 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable77171abc","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Wed, 05 May 2021 16:25:01 GMT + etag: + - W/"datetime'2021-05-05T16%3A25%3A01.5590920Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable77171abc') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Ok +- request: + body: '{"PartitionKey": "pk77171abc", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rk77171abc", "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: + - Wed, 05 May 2021 16:25:01 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:01 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable77171abc + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable77171abc/$metadata#uttable77171abc/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A25%3A02.3135752Z''\"","PartitionKey":"pk77171abc","RowKey":"rk77171abc","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-05T16:25:02.3135752Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Wed, 05 May 2021 16:25:01 GMT + etag: + - W/"datetime'2021-05-05T16%3A25%3A02.3135752Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttable77171abc(PartitionKey='pk77171abc',RowKey='rk77171abc') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk77171abc", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rk77171abc", "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", "value": 10}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '604' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:25:02 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + X-HTTP-Method: + - MERGE + x-ms-date: + - Wed, 05 May 2021 16:25:02 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable77171abc(PartitionKey='pk77171abc',RowKey='rk77171abc') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 05 May 2021 16:25:01 GMT + etag: + - W/"datetime'2021-05-05T16%3A25%3A02.4931848Z'" + 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: + - Wed, 05 May 2021 16:25:02 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:02 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable77171abc(PartitionKey='pk77171abc',RowKey='rk77171abc') + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable77171abc/$metadata#uttable77171abc/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A25%3A02.4931848Z''\"","PartitionKey":"pk77171abc","RowKey":"rk77171abc","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","value":10,"Timestamp":"2021-05-05T16:25:02.4931848Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Wed, 05 May 2021 16:25:02 GMT + etag: + - W/"datetime'2021-05-05T16%3A25%3A02.4931848Z'" + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: Ok +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:25:02 GMT + If-Match: + - W/"datetime'2021-05-05T16%3A25%3A02.3135752Z'" + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:02 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable77171abc(PartitionKey='pk77171abc',RowKey='rk77171abc') + response: + body: + string: "{\"odata.error\":{\"code\":\"UpdateConditionNotSatisfied\",\"message\"\ + :{\"lang\":\"en-us\",\"value\":\"The update condition specified in the request\ + \ was not satisfied.\\nRequestID:7193cf50-adbe-11eb-b547-002b67128e4c\\n\"\ + }}}\r\n" + headers: + content-type: + - application/json;odata=fullmetadata + date: + - Wed, 05 May 2021 16:25:02 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 412 + message: Precondition Failed +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:25:02 GMT + If-Match: + - W/"datetime'2021-05-05T16%3A25%3A02.4931848Z'" + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:02 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable77171abc(PartitionKey='pk77171abc',RowKey='rk77171abc') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 05 May 2021 16:25:02 GMT + server: + - Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Wed, 05 May 2021 16:25:02 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:02 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable77171abc') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 05 May 2021 16:25:02 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: + - Wed, 05 May 2021 16:25:03 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:03 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: + - Wed, 05 May 2021 16:25:02 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_get_entity_if_match.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_get_entity_if_match.yaml index 4058e4fd0659..1c952f78e7e6 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_get_entity_if_match.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_get_entity_if_match.yaml @@ -11,11 +11,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 16:38:03 GMT + - Wed, 05 May 2021 16:25:03 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 16:38:03 GMT + - Wed, 05 May 2021 16:25:03 GMT x-ms-version: - '2019-02-02' method: POST @@ -25,8 +25,8 @@ interactions: string: '{"TableName":"uttable7efd16b7","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' headers: content-type: application/json;odata=minimalmetadata - date: Fri, 18 Dec 2020 16:38:05 GMT - etag: W/"datetime'2020-12-18T16%3A38%3A04.5862920Z'" + date: Wed, 05 May 2021 16:25:04 GMT + etag: W/"datetime'2021-05-05T16%3A25%3A04.8830984Z'" location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable7efd16b7') server: Microsoft-HTTPAPI/2.0 transfer-encoding: chunked @@ -38,36 +38,37 @@ interactions: body: '{"PartitionKey": "pk7efd16b7", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk7efd16b7", "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:00Z", - "Birthday@odata.type": "Edm.DateTime", "birthday": "1970-10-04T00:00:00Z", "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"}' + "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: - - '577' + - '591' Content-Type: - application/json;odata=nometadata DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 16:38:04 GMT + - Wed, 05 May 2021 16:25:05 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 16:38:04 GMT + - Wed, 05 May 2021 16:25:05 GMT x-ms-version: - '2019-02-02' method: POST uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable7efd16b7 response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable7efd16b7/$metadata#uttable7efd16b7/@Element","odata.etag":"W/\"datetime''2020-12-18T16%3A38%3A05.3393416Z''\"","PartitionKey":"pk7efd16b7","RowKey":"rk7efd16b7","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":"2020-12-18T16:38:05.3393416Z"}' + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable7efd16b7/$metadata#uttable7efd16b7/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A25%3A05.6163848Z''\"","PartitionKey":"pk7efd16b7","RowKey":"rk7efd16b7","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-05T16:25:05.6163848Z"}' headers: content-type: application/json;odata=minimalmetadata - date: Fri, 18 Dec 2020 16:38:05 GMT - etag: W/"datetime'2020-12-18T16%3A38%3A05.3393416Z'" + date: Wed, 05 May 2021 16:25:04 GMT + etag: W/"datetime'2021-05-05T16%3A25%3A05.6163848Z'" location: https://fake_cosmos_account.table.cosmos.azure.com/uttable7efd16b7(PartitionKey='pk7efd16b7',RowKey='rk7efd16b7') server: Microsoft-HTTPAPI/2.0 transfer-encoding: chunked @@ -83,22 +84,22 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 16:38:05 GMT + - Wed, 05 May 2021 16:25:05 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 16:38:05 GMT + - Wed, 05 May 2021 16:25:05 GMT x-ms-version: - '2019-02-02' method: GET uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable7efd16b7(PartitionKey='pk7efd16b7',RowKey='rk7efd16b7') response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable7efd16b7/$metadata#uttable7efd16b7/@Element","odata.etag":"W/\"datetime''2020-12-18T16%3A38%3A05.3393416Z''\"","PartitionKey":"pk7efd16b7","RowKey":"rk7efd16b7","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":"2020-12-18T16:38:05.3393416Z"}' + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable7efd16b7/$metadata#uttable7efd16b7/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A25%3A05.6163848Z''\"","PartitionKey":"pk7efd16b7","RowKey":"rk7efd16b7","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-05T16:25:05.6163848Z"}' headers: content-type: application/json;odata=minimalmetadata - date: Fri, 18 Dec 2020 16:38:05 GMT - etag: W/"datetime'2020-12-18T16%3A38%3A05.3393416Z'" + date: Wed, 05 May 2021 16:25:04 GMT + etag: W/"datetime'2021-05-05T16%3A25%3A05.6163848Z'" server: Microsoft-HTTPAPI/2.0 transfer-encoding: chunked status: @@ -113,13 +114,13 @@ interactions: DataServiceVersion: - '3.0' Date: - - Fri, 18 Dec 2020 16:38:05 GMT + - Wed, 05 May 2021 16:25:05 GMT If-Match: - - W/"datetime'2020-12-18T16%3A38%3A05.3393416Z'" + - W/"datetime'2021-05-05T16%3A25%3A05.6163848Z'" User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 16:38:05 GMT + - Wed, 05 May 2021 16:25:05 GMT x-ms-version: - '2019-02-02' method: DELETE @@ -129,23 +130,54 @@ interactions: string: '' headers: content-length: '0' - date: Fri, 18 Dec 2020 16:38:05 GMT + date: Wed, 05 May 2021 16:25:04 GMT server: Microsoft-HTTPAPI/2.0 status: code: 204 message: No Content url: https://seankaneprim.table.cosmos.azure.com/uttable7efd16b7(PartitionKey='pk7efd16b7',RowKey='rk7efd16b7') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:25:05 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:05 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable7efd16b7(PartitionKey='pk7efd16b7',RowKey='rk7efd16b7') + response: + body: + string: "{\"odata.error\":{\"code\":\"ResourceNotFound\",\"message\":{\"lang\"\ + :\"en-us\",\"value\":\"The specified resource does not exist.\\nRequestID:7377f4f6-adbe-11eb-a3be-002b67128e4c\\\ + n\"}}}\r\n" + headers: + content-type: application/json;odata=minimalmetadata + date: Wed, 05 May 2021 16:25:05 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 404 + message: Not Found + url: https://seankaneprim.table.cosmos.azure.com/uttable7efd16b7(PartitionKey='pk7efd16b7',RowKey='rk7efd16b7') - request: body: null headers: Accept: - application/json Date: - - Fri, 18 Dec 2020 16:38:05 GMT + - Wed, 05 May 2021 16:25:05 GMT User-Agent: - - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Fri, 18 Dec 2020 16:38:05 GMT + - Wed, 05 May 2021 16:25:05 GMT x-ms-version: - '2019-02-02' method: DELETE @@ -155,7 +187,7 @@ interactions: string: '' headers: content-length: '0' - date: Fri, 18 Dec 2020 16:38:05 GMT + date: Wed, 05 May 2021 16:25:05 GMT server: Microsoft-HTTPAPI/2.0 status: code: 204 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_get_entity_if_match_entity_bad_etag.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_get_entity_if_match_entity_bad_etag.yaml new file mode 100644 index 000000000000..02a0c53b0e8f --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos_async.test_get_entity_if_match_entity_bad_etag.yaml @@ -0,0 +1,243 @@ +interactions: +- request: + body: '{"TableName": "uttable224a1d39"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:25:36 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:36 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable224a1d39","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Wed, 05 May 2021 16:25:37 GMT + etag: W/"datetime'2021-05-05T16%3A25%3A37.6236552Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable224a1d39') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/Tables +- request: + body: '{"PartitionKey": "pk224a1d39", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rk224a1d39", "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: + - Wed, 05 May 2021 16:25:37 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:37 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable224a1d39 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable224a1d39/$metadata#uttable224a1d39/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A25%3A38.2396936Z''\"","PartitionKey":"pk224a1d39","RowKey":"rk224a1d39","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-05T16:25:38.2396936Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Wed, 05 May 2021 16:25:37 GMT + etag: W/"datetime'2021-05-05T16%3A25%3A38.2396936Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable224a1d39(PartitionKey='pk224a1d39',RowKey='rk224a1d39') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable224a1d39 +- request: + body: '{"PartitionKey": "pk224a1d39", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rk224a1d39", "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", "value": 10}' + headers: + Accept: + - application/json + Content-Length: + - '604' + Content-Type: + - application/json + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:25:38 GMT + If-Match: + - '*' + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + X-HTTP-Method: + - MERGE + x-ms-date: + - Wed, 05 May 2021 16:25:38 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable224a1d39(PartitionKey='pk224a1d39',RowKey='rk224a1d39') + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 05 May 2021 16:25:37 GMT + etag: W/"datetime'2021-05-05T16%3A25%3A38.3818248Z'" + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/uttable224a1d39(PartitionKey='pk224a1d39',RowKey='rk224a1d39') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:25:38 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:38 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable224a1d39(PartitionKey='pk224a1d39',RowKey='rk224a1d39') + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable224a1d39/$metadata#uttable224a1d39/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A25%3A38.3818248Z''\"","PartitionKey":"pk224a1d39","RowKey":"rk224a1d39","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","value":10,"Timestamp":"2021-05-05T16:25:38.3818248Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Wed, 05 May 2021 16:25:37 GMT + etag: W/"datetime'2021-05-05T16%3A25%3A38.3818248Z'" + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/uttable224a1d39(PartitionKey='pk224a1d39',RowKey='rk224a1d39') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:25:38 GMT + If-Match: + - W/"datetime'2021-05-05T16%3A25%3A38.2396936Z'" + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:38 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable224a1d39(PartitionKey='pk224a1d39',RowKey='rk224a1d39') + response: + body: + string: "{\"odata.error\":{\"code\":\"UpdateConditionNotSatisfied\",\"message\"\ + :{\"lang\":\"en-us\",\"value\":\"The update condition specified in the request\ + \ was not satisfied.\\nRequestID:86f0b5c2-adbe-11eb-8cc3-002b67128e4c\\n\"\ + }}}\r\n" + headers: + content-type: application/json;odata=fullmetadata + date: Wed, 05 May 2021 16:25:38 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 412 + message: Precondition Failed + url: https://seankaneprim.table.cosmos.azure.com/uttable224a1d39(PartitionKey='pk224a1d39',RowKey='rk224a1d39') +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:25:38 GMT + If-Match: + - W/"datetime'2021-05-05T16%3A25%3A38.3818248Z'" + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:38 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable224a1d39(PartitionKey='pk224a1d39',RowKey='rk224a1d39') + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 05 May 2021 16:25:38 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/uttable224a1d39(PartitionKey='pk224a1d39',RowKey='rk224a1d39') +- request: + body: null + headers: + Accept: + - application/json + Date: + - Wed, 05 May 2021 16:25:38 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:25:38 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable224a1d39') + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 05 May 2021 16:25:38 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/Tables('uttable224a1d39') +version: 1 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 2655bb9a662f..bb33886df6fc 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_entity.py +++ b/sdk/tables/azure-data-tables/tests/test_table_entity.py @@ -900,23 +900,46 @@ def test_get_entity_if_match(self, tables_storage_account_name, tables_primary_s try: entity, etag = self._insert_random_entity() - # Act - # Do a get and confirm the etag is parsed correctly by using it - # as a condition to delete. - resp = self.table.get_entity(partition_key=entity['PartitionKey'], - row_key=entity['RowKey']) + entity = self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) self.table.delete_entity( - {"PartitionKey": resp['PartitionKey'], "RowKey": resp['RowKey']}, + entity, etag=etag, match_condition=MatchConditions.IfNotModified ) with pytest.raises(ResourceNotFoundError): - resp = self.table.get_entity(partition_key=entity['PartitionKey'], - row_key=entity['RowKey']) + self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) + finally: + self._tear_down() + + @TablesPreparer() + def test_get_entity_if_match_entity_bad_etag(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, old_etag = self._insert_random_entity() + + entity["value"] = 10 + self.table.update_entity(entity) + + # Get Entity and set old etag + e = self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + new_etag = e.metadata["etag"] + e.metadata["etag"] = old_etag + + with pytest.raises(HttpResponseError): + self.table.delete_entity(e, match_condition=MatchConditions.IfNotModified) + + # Try delete with correct etag + self.table.delete_entity(e, etag=new_etag, match_condition=MatchConditions.IfNotModified) - # Assert finally: self._tear_down() 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 06e848e76e15..ab4652dfc2b4 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 @@ -629,19 +629,46 @@ async def test_get_entity_if_match(self, tables_storage_account_name, tables_pri try: entity, etag = await self._insert_random_entity() - # Act - # Do a get and confirm the etag is parsed correctly by using it - # as a condition to delete. - resp = await self.table.get_entity(partition_key=entity['PartitionKey'], - row_key=entity['RowKey']) + entity = await self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) await self.table.delete_entity( - {"PartitionKey": resp['PartitionKey'], "RowKey": resp['RowKey']}, + entity, etag=etag, match_condition=MatchConditions.IfNotModified ) - # Assert + with pytest.raises(ResourceNotFoundError): + await self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) + finally: + await self._tear_down() + + @TablesPreparer() + async def test_get_entity_if_match_entity_bad_etag(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, old_etag = await self._insert_random_entity() + + entity["value"] = 10 + await self.table.update_entity(entity) + + # Get Entity and set old etag + e = await self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + new_etag = e.metadata["etag"] + e.metadata["etag"] = old_etag + + with pytest.raises(HttpResponseError): + await self.table.delete_entity(e, match_condition=MatchConditions.IfNotModified) + + # Try delete with correct etag + await self.table.delete_entity(e, etag=new_etag, match_condition=MatchConditions.IfNotModified) + finally: await self._tear_down() 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 6b482e34e63e..055459b23b6b 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 @@ -858,23 +858,50 @@ def test_get_entity_if_match(self, tables_cosmos_account_name, tables_primary_co try: entity, etag = self._insert_random_entity() - # Act - # Do a get and confirm the etag is parsed correctly by using it - # as a condition to delete. - resp = self.table.get_entity(partition_key=entity['PartitionKey'], - row_key=entity['RowKey']) + entity = self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) self.table.delete_entity( - {"PartitionKey": resp['PartitionKey'], "RowKey": resp['RowKey']}, + entity, etag=etag, match_condition=MatchConditions.IfNotModified ) - # Assert + with pytest.raises(ResourceNotFoundError): + self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) finally: self._tear_down() self.sleep(SLEEP_DELAY) + @CosmosPreparer() + def test_get_entity_if_match_entity_bad_etag(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, old_etag = self._insert_random_entity() + + entity["value"] = 10 + self.table.update_entity(entity) + + # Get Entity and set old etag + e = self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + new_etag = e.metadata["etag"] + e.metadata["etag"] = old_etag + + with pytest.raises(HttpResponseError): + self.table.delete_entity(e, match_condition=MatchConditions.IfNotModified) + + # Try delete with correct etag + self.table.delete_entity(e, etag=new_etag, match_condition=MatchConditions.IfNotModified) + + finally: + self._tear_down() + @CosmosPreparer() def test_get_entity_full_metadata(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 70723b4f5acd..c479e49c8e39 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 @@ -597,17 +597,46 @@ async def test_get_entity_if_match(self, tables_cosmos_account_name, tables_prim try: entity, etag = await self._insert_random_entity() - # Act - resp = await self.table.get_entity(partition_key=entity['PartitionKey'], - row_key=entity['RowKey']) + entity = await self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) await self.table.delete_entity( - {"PartitionKey": resp['PartitionKey'], "RowKey": resp['RowKey']}, + entity, etag=etag, match_condition=MatchConditions.IfNotModified ) - # Assert + with pytest.raises(ResourceNotFoundError): + await self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) + finally: + await self._tear_down() + + @CosmosPreparer() + async def test_get_entity_if_match_entity_bad_etag(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, old_etag = await self._insert_random_entity() + + entity["value"] = 10 + await self.table.update_entity(entity) + + # Get Entity and set old etag + e = await self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + new_etag = e.metadata["etag"] + e.metadata["etag"] = old_etag + + with pytest.raises(HttpResponseError): + await self.table.delete_entity(e, match_condition=MatchConditions.IfNotModified) + + # Try delete with correct etag + await self.table.delete_entity(e, etag=new_etag, match_condition=MatchConditions.IfNotModified) + finally: await self._tear_down() From ed645b72edbaf64f44ac41e0d3c79e60675ee5bb Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Wed, 5 May 2021 12:34:46 -0400 Subject: [PATCH 3/5] tests for batch --- ...atch.test_delete_batch_with_bad_kwarg.yaml | 319 ++++++++++++++++++ ...sync.test_delete_batch_with_bad_kwarg.yaml | 254 ++++++++++++++ ...smos.test_delete_batch_with_bad_kwarg.yaml | 282 ++++++++++++++++ ...sync.test_delete_batch_with_bad_kwarg.yaml | 263 +++++++++++++++ .../tests/test_table_batch.py | 26 ++ .../tests/test_table_batch_async.py | 26 ++ .../tests/test_table_batch_cosmos.py | 26 ++ .../tests/test_table_batch_cosmos_async.py | 26 ++ 8 files changed, 1222 insertions(+) create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_delete_batch_with_bad_kwarg.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_batch_async.test_delete_batch_with_bad_kwarg.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_batch_cosmos.test_delete_batch_with_bad_kwarg.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_batch_cosmos_async.test_delete_batch_with_bad_kwarg.yaml diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_delete_batch_with_bad_kwarg.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_delete_batch_with_bad_kwarg.yaml new file mode 100644 index 000000000000..0319c5ec14a7 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_delete_batch_with_bad_kwarg.yaml @@ -0,0 +1,319 @@ +interactions: +- request: + body: '{"TableName": "uttableee7113c6"}' + 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: + - Wed, 05 May 2021 16:33:06 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:06 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":"uttableee7113c6"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Wed, 05 May 2021 16:33:06 GMT + location: + - https://fake_table_account.table.core.windows.net/Tables('uttableee7113c6') + 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": "001", "PartitionKey@odata.type": "Edm.String", "RowKey": + "batch_negative_1", "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: + - '590' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:06 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:06 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttableee7113c6 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttableee7113c6/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A33%3A07.0314532Z''\"","PartitionKey":"001","RowKey":"batch_negative_1","Timestamp":"2021-05-05T16:33:07.0314532Z","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: + - Wed, 05 May 2021 16:33:06 GMT + etag: + - W/"datetime'2021-05-05T16%3A33%3A07.0314532Z'" + location: + - https://fake_table_account.table.core.windows.net/uttableee7113c6(PartitionKey='001',RowKey='batch_negative_1') + 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 + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:06 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:06 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttableee7113c6(PartitionKey='001',RowKey='batch_negative_1') + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttableee7113c6/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A33%3A07.0314532Z''\"","PartitionKey":"001","RowKey":"batch_negative_1","Timestamp":"2021-05-05T16:33:07.0314532Z","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: + - Wed, 05 May 2021 16:33:06 GMT + etag: + - W/"datetime'2021-05-05T16%3A33%3A07.0314532Z'" + 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: "--batch_7ede9170-babf-4049-9bc8-8d66e6a0da1b\r\nContent-Type: multipart/mixed;\ + \ boundary=changeset_15be1f87-b28c-4685-ae2a-d458c0ef4f89\r\n\r\n--changeset_15be1f87-b28c-4685-ae2a-d458c0ef4f89\r\ + \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\ + \ 0\r\n\r\nDELETE https://seankaneprim.table.core.windows.net/uttableee7113c6(PartitionKey='001',RowKey='batch_negative_1')\ + \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nIf-Match:\ + \ W/\"datetime'2012-06-15T22%3A51%3A44.9662825Z'\"\r\nAccept: application/json;odata=minimalmetadata\r\ + \nx-ms-date: Wed, 05 May 2021 16:33:07 GMT\r\nDate: Wed, 05 May 2021 16:33:07\ + \ GMT\r\n\r\n\r\n--changeset_15be1f87-b28c-4685-ae2a-d458c0ef4f89--\r\n\r\n\ + --batch_7ede9170-babf-4049-9bc8-8d66e6a0da1b--\r\n" + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '735' + Content-Type: + - multipart/mixed; boundary=batch_7ede9170-babf-4049-9bc8-8d66e6a0da1b + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:07 GMT + MaxDataServiceVersion: + - 3.0;NetFx + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:07 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/$batch + response: + body: + string: "--batchresponse_833c4844-93a1-4ac7-8bf6-2a30561f1bf7\r\nContent-Type:\ + \ multipart/mixed; boundary=changesetresponse_e981e2d4-1855-44ac-bfb3-95365e89d759\r\ + \n\r\n--changesetresponse_e981e2d4-1855-44ac-bfb3-95365e89d759\r\nContent-Type:\ + \ application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 412\ + \ Precondition Failed\r\nX-Content-Type-Options: nosniff\r\nCache-Control:\ + \ no-cache\r\nDataServiceVersion: 3.0;\r\nContent-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8\r\ + \n\r\n{\"odata.error\":{\"code\":\"UpdateConditionNotSatisfied\",\"message\"\ + :{\"lang\":\"en-US\",\"value\":\"The update condition specified in the request\ + \ was not satisfied.\\nRequestId:505f0dd0-3002-0075-32cc-41b108000000\\nTime:2021-05-05T16:33:07.4047215Z\"\ + }}}\r\n--changesetresponse_e981e2d4-1855-44ac-bfb3-95365e89d759--\r\n--batchresponse_833c4844-93a1-4ac7-8bf6-2a30561f1bf7--\r\ + \n" + headers: + cache-control: + - no-cache + content-type: + - multipart/mixed; boundary=batchresponse_833c4844-93a1-4ac7-8bf6-2a30561f1bf7 + date: + - Wed, 05 May 2021 16:33:07 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: 202 + message: Accepted +- request: + body: "--batch_3d82498b-6415-4d5e-b00a-51a2c097475e\r\nContent-Type: multipart/mixed;\ + \ boundary=changeset_226b7ff2-5096-4fd8-afec-456ddec65eb7\r\n\r\n--changeset_226b7ff2-5096-4fd8-afec-456ddec65eb7\r\ + \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\ + \ 0\r\n\r\nDELETE https://seankaneprim.table.core.windows.net/uttableee7113c6(PartitionKey='001',RowKey='batch_negative_1')\ + \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nIf-Match:\ + \ W/\"datetime'2021-05-05T16%3A33%3A07.0314532Z'\"\r\nAccept: application/json;odata=minimalmetadata\r\ + \nx-ms-date: Wed, 05 May 2021 16:33:07 GMT\r\nDate: Wed, 05 May 2021 16:33:07\ + \ GMT\r\n\r\n\r\n--changeset_226b7ff2-5096-4fd8-afec-456ddec65eb7--\r\n\r\n\ + --batch_3d82498b-6415-4d5e-b00a-51a2c097475e--\r\n" + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '735' + Content-Type: + - multipart/mixed; boundary=batch_3d82498b-6415-4d5e-b00a-51a2c097475e + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:07 GMT + MaxDataServiceVersion: + - 3.0;NetFx + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:07 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/$batch + response: + body: + string: "--batchresponse_936c04d7-3bd1-4d94-8837-cbf222baa948\r\nContent-Type:\ + \ multipart/mixed; boundary=changesetresponse_df66c0dc-4456-484b-9258-9d9b9f6bae6e\r\ + \n\r\n--changesetresponse_df66c0dc-4456-484b-9258-9d9b9f6bae6e\r\nContent-Type:\ + \ application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204\ + \ No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\ + \nDataServiceVersion: 1.0;\r\n\r\n\r\n--changesetresponse_df66c0dc-4456-484b-9258-9d9b9f6bae6e--\r\ + \n--batchresponse_936c04d7-3bd1-4d94-8837-cbf222baa948--\r\n" + headers: + cache-control: + - no-cache + content-type: + - multipart/mixed; boundary=batchresponse_936c04d7-3bd1-4d94-8837-cbf222baa948 + date: + - Wed, 05 May 2021 16:33:07 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: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Wed, 05 May 2021 16:33:07 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:07 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttableee7113c6') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 05 May 2021 16:33:07 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_batch_async.test_delete_batch_with_bad_kwarg.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch_async.test_delete_batch_with_bad_kwarg.yaml new file mode 100644 index 000000000000..e340641186fc --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch_async.test_delete_batch_with_bad_kwarg.yaml @@ -0,0 +1,254 @@ +interactions: +- request: + body: '{"TableName": "uttable70681643"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:07 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:07 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":"uttable70681643"}' + headers: + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Wed, 05 May 2021 16:33:08 GMT + location: https://fake_table_account.table.core.windows.net/Tables('uttable70681643') + 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": "001", "PartitionKey@odata.type": "Edm.String", "RowKey": + "batch_negative_1", "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: + - '590' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:08 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:08 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttable70681643 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable70681643/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A33%3A08.5667399Z''\"","PartitionKey":"001","RowKey":"batch_negative_1","Timestamp":"2021-05-05T16:33:08.5667399Z","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: Wed, 05 May 2021 16:33:08 GMT + etag: W/"datetime'2021-05-05T16%3A33%3A08.5667399Z'" + location: https://fake_table_account.table.core.windows.net/uttable70681643(PartitionKey='001',RowKey='batch_negative_1') + 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/uttable70681643 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:08 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:08 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttable70681643(PartitionKey='001',RowKey='batch_negative_1') + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable70681643/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A33%3A08.5667399Z''\"","PartitionKey":"001","RowKey":"batch_negative_1","Timestamp":"2021-05-05T16:33:08.5667399Z","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: Wed, 05 May 2021 16:33:08 GMT + etag: W/"datetime'2021-05-05T16%3A33%3A08.5667399Z'" + 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/uttable70681643(PartitionKey='001',RowKey='batch_negative_1') +- request: + body: "--batch_fd11d4cd-f988-47d1-b178-e474d62a684b\r\nContent-Type: multipart/mixed;\ + \ boundary=changeset_bb730c62-2bc8-46c3-9b94-1b501fdf3fd6\r\n\r\n--changeset_bb730c62-2bc8-46c3-9b94-1b501fdf3fd6\r\ + \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\ + \ 0\r\n\r\nDELETE https://seankaneprim.table.core.windows.net/uttable70681643(PartitionKey='001',RowKey='batch_negative_1')\ + \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nIf-Match:\ + \ W/\"datetime'2012-06-15T22%3A51%3A44.9662825Z'\"\r\nAccept: application/json;odata=minimalmetadata\r\ + \nx-ms-date: Wed, 05 May 2021 16:33:08 GMT\r\nDate: Wed, 05 May 2021 16:33:08\ + \ GMT\r\n\r\n\r\n--changeset_bb730c62-2bc8-46c3-9b94-1b501fdf3fd6--\r\n\r\n\ + --batch_fd11d4cd-f988-47d1-b178-e474d62a684b--\r\n" + headers: + Accept: + - application/json + Content-Length: + - '735' + Content-Type: + - multipart/mixed; boundary=batch_fd11d4cd-f988-47d1-b178-e474d62a684b + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:08 GMT + MaxDataServiceVersion: + - 3.0;NetFx + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:08 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/$batch + response: + body: + string: "--batchresponse_3498d08d-5d66-43c2-ae81-1147c7e8af26\r\nContent-Type:\ + \ multipart/mixed; boundary=changesetresponse_0b4a212f-034c-473a-949d-2f586227bbb7\r\ + \n\r\n--changesetresponse_0b4a212f-034c-473a-949d-2f586227bbb7\r\nContent-Type:\ + \ application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 412\ + \ Precondition Failed\r\nX-Content-Type-Options: nosniff\r\nCache-Control:\ + \ no-cache\r\nDataServiceVersion: 3.0;\r\nContent-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8\r\ + \n\r\n{\"odata.error\":{\"code\":\"UpdateConditionNotSatisfied\",\"message\"\ + :{\"lang\":\"en-US\",\"value\":\"The update condition specified in the request\ + \ was not satisfied.\\nRequestId:bfa3c798-c002-0061-76cc-41f967000000\\nTime:2021-05-05T16:33:08.9199901Z\"\ + }}}\r\n--changesetresponse_0b4a212f-034c-473a-949d-2f586227bbb7--\r\n--batchresponse_3498d08d-5d66-43c2-ae81-1147c7e8af26--\r\ + \n" + headers: + cache-control: no-cache + content-type: multipart/mixed; boundary=batchresponse_3498d08d-5d66-43c2-ae81-1147c7e8af26 + date: Wed, 05 May 2021 16:33:08 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: 202 + message: Accepted + url: https://seankaneprim.table.core.windows.net/$batch +- request: + body: "--batch_c8284c9b-1d01-41c1-9f87-e544e3ac49e9\r\nContent-Type: multipart/mixed;\ + \ boundary=changeset_7761c230-6f15-4144-ba65-fb4f202a9c6b\r\n\r\n--changeset_7761c230-6f15-4144-ba65-fb4f202a9c6b\r\ + \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\ + \ 0\r\n\r\nDELETE https://seankaneprim.table.core.windows.net/uttable70681643(PartitionKey='001',RowKey='batch_negative_1')\ + \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nIf-Match:\ + \ W/\"datetime'2021-05-05T16%3A33%3A08.5667399Z'\"\r\nAccept: application/json;odata=minimalmetadata\r\ + \nx-ms-date: Wed, 05 May 2021 16:33:08 GMT\r\nDate: Wed, 05 May 2021 16:33:08\ + \ GMT\r\n\r\n\r\n--changeset_7761c230-6f15-4144-ba65-fb4f202a9c6b--\r\n\r\n\ + --batch_c8284c9b-1d01-41c1-9f87-e544e3ac49e9--\r\n" + headers: + Accept: + - application/json + Content-Length: + - '735' + Content-Type: + - multipart/mixed; boundary=batch_c8284c9b-1d01-41c1-9f87-e544e3ac49e9 + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:08 GMT + MaxDataServiceVersion: + - 3.0;NetFx + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:08 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/$batch + response: + body: + string: "--batchresponse_414e88dc-731a-4c02-a41c-e028e00077f1\r\nContent-Type:\ + \ multipart/mixed; boundary=changesetresponse_9027b7b1-e146-475a-bc66-50c99598ca11\r\ + \n\r\n--changesetresponse_9027b7b1-e146-475a-bc66-50c99598ca11\r\nContent-Type:\ + \ application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204\ + \ No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\ + \nDataServiceVersion: 1.0;\r\n\r\n\r\n--changesetresponse_9027b7b1-e146-475a-bc66-50c99598ca11--\r\ + \n--batchresponse_414e88dc-731a-4c02-a41c-e028e00077f1--\r\n" + headers: + cache-control: no-cache + content-type: multipart/mixed; boundary=batchresponse_414e88dc-731a-4c02-a41c-e028e00077f1 + date: Wed, 05 May 2021 16:33:09 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: 202 + message: Accepted + url: https://seankaneprim.table.core.windows.net/$batch +- request: + body: null + headers: + Accept: + - application/json + Date: + - Wed, 05 May 2021 16:33:09 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:09 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttable70681643') + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Wed, 05 May 2021 16:33: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://seankaneprim.table.core.windows.net/Tables('uttable70681643') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_batch_cosmos.test_delete_batch_with_bad_kwarg.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch_cosmos.test_delete_batch_with_bad_kwarg.yaml new file mode 100644 index 000000000000..519d1068c79c --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch_cosmos.test_delete_batch_with_bad_kwarg.yaml @@ -0,0 +1,282 @@ +interactions: +- request: + body: '{"TableName": "uttable890c16b9"}' + 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: + - Wed, 05 May 2021 16:33:09 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:09 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable890c16b9","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Wed, 05 May 2021 16:33:10 GMT + etag: + - W/"datetime'2021-05-05T16%3A33%3A10.5386504Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable890c16b9') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Ok +- request: + body: '{"PartitionKey": "001", "PartitionKey@odata.type": "Edm.String", "RowKey": + "batch_negative_1", "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: + - '590' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:11 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:11 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable890c16b9 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable890c16b9/$metadata#uttable890c16b9/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A33%3A11.3570312Z''\"","PartitionKey":"001","RowKey":"batch_negative_1","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-05T16:33:11.3570312Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Wed, 05 May 2021 16:33:11 GMT + etag: + - W/"datetime'2021-05-05T16%3A33%3A11.3570312Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttable890c16b9(PartitionKey='001',RowKey='batch_negative_1') + 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 + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:11 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:11 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable890c16b9(PartitionKey='001',RowKey='batch_negative_1') + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable890c16b9/$metadata#uttable890c16b9/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A33%3A11.3570312Z''\"","PartitionKey":"001","RowKey":"batch_negative_1","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-05T16:33:11.3570312Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Wed, 05 May 2021 16:33:11 GMT + etag: + - W/"datetime'2021-05-05T16%3A33%3A11.3570312Z'" + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: Ok +- request: + body: "--batch_7182a7ef-96ca-4766-b9f1-8ccd2d8e1624\r\nContent-Type: multipart/mixed;\ + \ boundary=changeset_4197d55b-35df-4742-8601-2be80049c34b\r\n\r\n--changeset_4197d55b-35df-4742-8601-2be80049c34b\r\ + \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\ + \ 0\r\n\r\nDELETE https://seankaneprim.table.cosmos.azure.com/uttable890c16b9(PartitionKey='001',RowKey='batch_negative_1')\ + \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nIf-Match:\ + \ W/\"datetime'2012-06-15T22%3A51%3A44.9662825Z'\"\r\nAccept: application/json;odata=minimalmetadata\r\ + \nx-ms-date: Wed, 05 May 2021 16:33:11 GMT\r\nDate: Wed, 05 May 2021 16:33:11\ + \ GMT\r\n\r\n\r\n--changeset_4197d55b-35df-4742-8601-2be80049c34b--\r\n\r\n\ + --batch_7182a7ef-96ca-4766-b9f1-8ccd2d8e1624--\r\n" + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '735' + Content-Type: + - multipart/mixed; boundary=batch_7182a7ef-96ca-4766-b9f1-8ccd2d8e1624 + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:11 GMT + MaxDataServiceVersion: + - 3.0;NetFx + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:11 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/$batch + response: + body: + string: "--batchresponse_f407c5f4-fa59-4a63-a5d5-7a1e97085ab0\nContent-Type:\ + \ multipart/mixed; boundary=changesetresponse_42281cc4-a8b1-4e85-91c7-5916edd63fcd\r\ + \n\r\n--changesetresponse_42281cc4-a8b1-4e85-91c7-5916edd63fcd\nContent-Type:\ + \ application/http\nContent-Transfer-Encoding: binary\n\nHTTP/1.1 412 Precondition\ + \ Failed\r\nContent-Type: application/json;odata=fullmetadata\r\n\r\n{\"odata.error\"\ + :{\"code\":\"UpdateConditionNotSatisfied\",\"message\":{\"lang\":\"en-us\"\ + ,\"value\":\"0:The update condition specified in the request was not satisfied.\\\ + n\\nRequestID:94f6a376-adbf-11eb-a5f5-002b67128e4c\\n\"}}}\r\n--changesetresponse_42281cc4-a8b1-4e85-91c7-5916edd63fcd--\n\ + --batchresponse_f407c5f4-fa59-4a63-a5d5-7a1e97085ab0--\r\n" + headers: + content-type: + - multipart/mixed; boundary=batchresponse_f407c5f4-fa59-4a63-a5d5-7a1e97085ab0 + date: + - Wed, 05 May 2021 16:33:11 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 202 + message: Accepted +- request: + body: "--batch_4bf14bf7-6893-4601-889f-ed0d7bdfe9e9\r\nContent-Type: multipart/mixed;\ + \ boundary=changeset_650732b4-7032-48e1-ba2e-c33c610b1e96\r\n\r\n--changeset_650732b4-7032-48e1-ba2e-c33c610b1e96\r\ + \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\ + \ 0\r\n\r\nDELETE https://seankaneprim.table.cosmos.azure.com/uttable890c16b9(PartitionKey='001',RowKey='batch_negative_1')\ + \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nIf-Match:\ + \ W/\"datetime'2021-05-05T16%3A33%3A11.3570312Z'\"\r\nAccept: application/json;odata=minimalmetadata\r\ + \nx-ms-date: Wed, 05 May 2021 16:33:11 GMT\r\nDate: Wed, 05 May 2021 16:33:11\ + \ GMT\r\n\r\n\r\n--changeset_650732b4-7032-48e1-ba2e-c33c610b1e96--\r\n\r\n\ + --batch_4bf14bf7-6893-4601-889f-ed0d7bdfe9e9--\r\n" + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '735' + Content-Type: + - multipart/mixed; boundary=batch_4bf14bf7-6893-4601-889f-ed0d7bdfe9e9 + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:11 GMT + MaxDataServiceVersion: + - 3.0;NetFx + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:11 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/$batch + response: + body: + string: "--batchresponse_6dc33b3a-9309-4e77-ae5c-7c83a0e02ef6\nContent-Type:\ + \ multipart/mixed; boundary=changesetresponse_190f4b34-3c9b-4892-b55f-4d1a1d498f30\r\ + \n\r\n--changesetresponse_190f4b34-3c9b-4892-b55f-4d1a1d498f30\nContent-Type:\ + \ application/http\nContent-Transfer-Encoding: binary\n\nHTTP/1.1 204 No Content\r\ + \nContent-ID: 1\r\n\r\n\r\n--changesetresponse_190f4b34-3c9b-4892-b55f-4d1a1d498f30--\n\ + --batchresponse_6dc33b3a-9309-4e77-ae5c-7c83a0e02ef6--\r\n" + headers: + content-type: + - multipart/mixed; boundary=batchresponse_6dc33b3a-9309-4e77-ae5c-7c83a0e02ef6 + date: + - Wed, 05 May 2021 16:33:11 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Wed, 05 May 2021 16:33:11 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:11 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable890c16b9') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 05 May 2021 16:33:12 GMT + server: + - Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_batch_cosmos_async.test_delete_batch_with_bad_kwarg.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch_cosmos_async.test_delete_batch_with_bad_kwarg.yaml new file mode 100644 index 000000000000..c06b7281cd04 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch_cosmos_async.test_delete_batch_with_bad_kwarg.yaml @@ -0,0 +1,263 @@ +interactions: +- request: + body: '{"TableName": "uttable1cb51936"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:42 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:42 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable1cb51936","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Wed, 05 May 2021 16:33:43 GMT + etag: W/"datetime'2021-05-05T16%3A33%3A43.2065032Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable1cb51936') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/Tables +- request: + body: '{"PartitionKey": "001", "PartitionKey@odata.type": "Edm.String", "RowKey": + "batch_negative_1", "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: + - '590' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:43 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:43 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable1cb51936 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable1cb51936/$metadata#uttable1cb51936/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A33%3A43.9891464Z''\"","PartitionKey":"001","RowKey":"batch_negative_1","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-05T16:33:43.9891464Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Wed, 05 May 2021 16:33:43 GMT + etag: W/"datetime'2021-05-05T16%3A33%3A43.9891464Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable1cb51936(PartitionKey='001',RowKey='batch_negative_1') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable1cb51936 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:43 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:43 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable1cb51936(PartitionKey='001',RowKey='batch_negative_1') + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable1cb51936/$metadata#uttable1cb51936/@Element","odata.etag":"W/\"datetime''2021-05-05T16%3A33%3A43.9891464Z''\"","PartitionKey":"001","RowKey":"batch_negative_1","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-05T16:33:43.9891464Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Wed, 05 May 2021 16:33:43 GMT + etag: W/"datetime'2021-05-05T16%3A33%3A43.9891464Z'" + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/uttable1cb51936(PartitionKey='001',RowKey='batch_negative_1') +- request: + body: "--batch_ab56bfd0-a18f-413e-ac41-edd6889dd46b\r\nContent-Type: multipart/mixed;\ + \ boundary=changeset_5d0123a4-4dad-43ed-92f7-cf8b43b79cb4\r\n\r\n--changeset_5d0123a4-4dad-43ed-92f7-cf8b43b79cb4\r\ + \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\ + \ 0\r\n\r\nDELETE https://seankaneprim.table.cosmos.azure.com/uttable1cb51936(PartitionKey='001',RowKey='batch_negative_1')\ + \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nIf-Match:\ + \ W/\"datetime'2012-06-15T22%3A51%3A44.9662825Z'\"\r\nAccept: application/json;odata=minimalmetadata\r\ + \nx-ms-date: Wed, 05 May 2021 16:33:44 GMT\r\nDate: Wed, 05 May 2021 16:33:44\ + \ GMT\r\n\r\n\r\n--changeset_5d0123a4-4dad-43ed-92f7-cf8b43b79cb4--\r\n\r\n\ + --batch_ab56bfd0-a18f-413e-ac41-edd6889dd46b--\r\n" + headers: + Accept: + - application/json + Content-Length: + - '735' + Content-Type: + - multipart/mixed; boundary=batch_ab56bfd0-a18f-413e-ac41-edd6889dd46b + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:44 GMT + MaxDataServiceVersion: + - 3.0;NetFx + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:44 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/$batch + response: + body: + string: "--batchresponse_84df3b89-cdce-422b-9d06-f504b4d83eed\nContent-Type:\ + \ multipart/mixed; boundary=changesetresponse_bbd169bb-dcc6-4bfd-b05a-d0278736af54\r\ + \n\r\n--changesetresponse_bbd169bb-dcc6-4bfd-b05a-d0278736af54\nContent-Type:\ + \ application/http\nContent-Transfer-Encoding: binary\n\nHTTP/1.1 412 Precondition\ + \ Failed\r\nContent-Type: application/json;odata=fullmetadata\r\n\r\n{\"odata.error\"\ + :{\"code\":\"UpdateConditionNotSatisfied\",\"message\":{\"lang\":\"en-us\"\ + ,\"value\":\"0:The update condition specified in the request was not satisfied.\\\ + n\\nRequestID:a87033cc-adbf-11eb-8de5-002b67128e4c\\n\"}}}\r\n--changesetresponse_bbd169bb-dcc6-4bfd-b05a-d0278736af54--\n\ + --batchresponse_84df3b89-cdce-422b-9d06-f504b4d83eed--\r\n" + headers: + content-type: multipart/mixed; boundary=batchresponse_84df3b89-cdce-422b-9d06-f504b4d83eed + date: Wed, 05 May 2021 16:33:43 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 202 + message: Accepted + url: https://seankaneprim.table.cosmos.azure.com/$batch +- request: + body: "--batch_1bc940df-4449-4c48-aee9-a786c420fdc3\r\nContent-Type: multipart/mixed;\ + \ boundary=changeset_4d03eb3e-cf08-4261-bab4-b5c486ca764a\r\n\r\n--changeset_4d03eb3e-cf08-4261-bab4-b5c486ca764a\r\ + \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\ + \ 0\r\n\r\nDELETE https://seankaneprim.table.cosmos.azure.com/uttable1cb51936(PartitionKey='001',RowKey='batch_negative_1')\ + \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nIf-Match:\ + \ W/\"datetime'2021-05-05T16%3A33%3A43.9891464Z'\"\r\nAccept: application/json;odata=minimalmetadata\r\ + \nx-ms-date: Wed, 05 May 2021 16:33:44 GMT\r\nDate: Wed, 05 May 2021 16:33:44\ + \ GMT\r\n\r\n\r\n--changeset_4d03eb3e-cf08-4261-bab4-b5c486ca764a--\r\n\r\n\ + --batch_1bc940df-4449-4c48-aee9-a786c420fdc3--\r\n" + headers: + Accept: + - application/json + Content-Length: + - '735' + Content-Type: + - multipart/mixed; boundary=batch_1bc940df-4449-4c48-aee9-a786c420fdc3 + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 16:33:44 GMT + MaxDataServiceVersion: + - 3.0;NetFx + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:44 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/$batch + response: + body: + string: "--batchresponse_0cfc6008-1660-46e6-b502-1a55088ad873\nContent-Type:\ + \ multipart/mixed; boundary=changesetresponse_692f2150-a0ba-438d-b7ed-2d5dcc95648b\r\ + \n\r\n--changesetresponse_692f2150-a0ba-438d-b7ed-2d5dcc95648b\nContent-Type:\ + \ application/http\nContent-Transfer-Encoding: binary\n\nHTTP/1.1 204 No Content\r\ + \nContent-ID: 1\r\n\r\n\r\n--changesetresponse_692f2150-a0ba-438d-b7ed-2d5dcc95648b--\n\ + --batchresponse_0cfc6008-1660-46e6-b502-1a55088ad873--\r\n" + headers: + content-type: multipart/mixed; boundary=batchresponse_0cfc6008-1660-46e6-b502-1a55088ad873 + date: Wed, 05 May 2021 16:33:43 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 202 + message: Accepted + url: https://seankaneprim.table.cosmos.azure.com/$batch +- request: + body: null + headers: + Accept: + - application/json + Date: + - Wed, 05 May 2021 16:33:44 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:44 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable1cb51936') + response: + body: + string: '' + headers: + content-length: '0' + date: Wed, 05 May 2021 16:33:44 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/Tables('uttable1cb51936') +- request: + body: null + headers: + Accept: + - application/json + Date: + - Wed, 05 May 2021 16:33:45 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 16:33:45 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable1cb51936') + response: + body: + string: "{\"odata.error\":{\"code\":\"ResourceNotFound\",\"message\":{\"lang\"\ + :\"en-us\",\"value\":\"The specified resource does not exist.\\nRequestID:a8fc35f6-adbf-11eb-b450-002b67128e4c\\\ + n\"}}}\r\n" + headers: + content-type: application/json;odata=fullmetadata + date: Wed, 05 May 2021 16:33:44 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 404 + message: Not Found + url: https://seankaneprim.table.cosmos.azure.com/Tables('uttable1cb51936') +version: 1 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 400e12d1ebc5..9df8db02a89e 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_batch.py +++ b/sdk/tables/azure-data-tables/tests/test_table_batch.py @@ -791,6 +791,32 @@ def test_new_delete_nonexistent_entity(self, tables_storage_account_name, tables finally: self._tear_down() + @pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3") + @TablesPreparer() + def test_delete_batch_with_bad_kwarg(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._create_random_entity_dict('001', 'batch_negative_1') + self.table.create_entity(entity) + + received = self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + good_etag = received.metadata["etag"] + received.metadata["etag"] = u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"' + + batch = [('delete', received, {"match_condition": MatchConditions.IfNotModified})] + + with pytest.raises(TableTransactionError): + self.table.submit_transaction(batch) + + received.metadata["etag"] = good_etag + batch = [('delete', received, {"match_condition": MatchConditions.IfNotModified})] + resp = self.table.submit_transaction(batch) + + assert resp is not None + finally: + self._tear_down() + @pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3") @pytest.mark.live_test_only @TablesPreparer() 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 924d94349759..3f81b975df8a 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 @@ -760,3 +760,29 @@ async def test_batch_request_too_large(self, tables_storage_account_name, tables finally: await self._tear_down() + @pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3") + @TablesPreparer() + async def test_delete_batch_with_bad_kwarg(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 = self._create_random_entity_dict('001', 'batch_negative_1') + await self.table.create_entity(entity) + + received = await self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + good_etag = received.metadata["etag"] + received.metadata["etag"] = u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"' + + batch = [('delete', received, {"match_condition": MatchConditions.IfNotModified})] + + with pytest.raises(TableTransactionError): + await self.table.submit_transaction(batch) + + received.metadata["etag"] = good_etag + batch = [('delete', received, {"match_condition": MatchConditions.IfNotModified})] + resp = await self.table.submit_transaction(batch) + + assert resp is not None + finally: + await self._tear_down() + diff --git a/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos.py b/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos.py index 068166391de0..9ecfda6b6890 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos.py +++ b/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos.py @@ -584,6 +584,32 @@ def test_new_delete_nonexistent_entity(self, tables_cosmos_account_name, tables_ finally: self._tear_down() + @pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3") + @CosmosPreparer() + def test_delete_batch_with_bad_kwarg(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._create_random_entity_dict('001', 'batch_negative_1') + self.table.create_entity(entity) + + received = self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + good_etag = received.metadata["etag"] + received.metadata["etag"] = u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"' + + batch = [('delete', received, {"match_condition": MatchConditions.IfNotModified})] + + with pytest.raises(TableTransactionError): + self.table.submit_transaction(batch) + + received.metadata["etag"] = good_etag + batch = [('delete', received, {"match_condition": MatchConditions.IfNotModified})] + resp = self.table.submit_transaction(batch) + + assert resp is not None + finally: + self._tear_down() + @pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3") @pytest.mark.live_test_only # Request bodies are very large @CosmosPreparer() diff --git a/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos_async.py b/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos_async.py index c62702d02b23..c5c5c3903c5d 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos_async.py @@ -665,3 +665,29 @@ async def test_batch_request_too_large(self, tables_cosmos_account_name, tables_ finally: await self._tear_down() + @pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3") + @CosmosPreparer() + async def test_delete_batch_with_bad_kwarg(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 = self._create_random_entity_dict('001', 'batch_negative_1') + await self.table.create_entity(entity) + + received = await self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + good_etag = received.metadata["etag"] + received.metadata["etag"] = u'W/"datetime\'2012-06-15T22%3A51%3A44.9662825Z\'"' + + batch = [('delete', received, {"match_condition": MatchConditions.IfNotModified})] + + with pytest.raises(TableTransactionError): + await self.table.submit_transaction(batch) + + received.metadata["etag"] = good_etag + batch = [('delete', received, {"match_condition": MatchConditions.IfNotModified})] + resp = await self.table.submit_transaction(batch) + + assert resp is not None + finally: + await self._tear_down() + From 64a450ac62f8b4614a9158176f992c33c7d7316b Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Wed, 5 May 2021 13:32:31 -0400 Subject: [PATCH 4/5] adding one more test for a scenario to catch, fixing up sloppiness --- .../azure/data/tables/_table_batch.py | 4 +- .../azure/data/tables/_table_client.py | 9 +- .../data/tables/aio/_table_batch_async.py | 4 +- .../data/tables/aio/_table_client_async.py | 19 +- ...t_delete_entity_if_match_table_entity.yaml | 278 +++++++++++++++++ ...t_delete_entity_if_match_table_entity.yaml | 281 ++++++++++++++++++ .../tests/test_table_entity.py | 23 ++ .../tests/test_table_entity_async.py | 23 ++ .../tests/test_table_entity_cosmos.py | 23 ++ .../tests/test_table_entity_cosmos_async.py | 26 +- 10 files changed, 669 insertions(+), 21 deletions(-) create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_if_match_table_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_delete_entity_if_match_table_entity.yaml diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py index 886c420bab71..14914e984bd4 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py @@ -243,7 +243,7 @@ def update( if match_condition and not etag: try: etag = entity.metadata.get("etag", None) - except AttributeError: + except (AttributeError, TypeError): pass if_match, _ = _get_match_headers( @@ -529,7 +529,7 @@ def delete( if match_condition and not etag: try: etag = entity.metadata.get("etag", None) - except AttributeError: + except (AttributeError, TypeError): pass if_match, _ = _get_match_headers( 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 ec31b54393c0..e115856a891f 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, overload +from typing import Optional, Any, Type, Union, List, Tuple, Dict, Mapping, Iterable, overload try: from urllib.parse import urlparse, unquote except ImportError: @@ -328,7 +328,7 @@ def delete_entity(self, *args, **kwargs): if match_condition and entity and not etag: try: etag = entity.metadata.get("etag", None) - except AttributeError: + except (AttributeError, TypeError): pass if_match, _ = _get_match_headers( @@ -424,7 +424,10 @@ def update_entity( match_condition = kwargs.pop("match_condition", None) etag = kwargs.pop("etag", None) if match_condition and not etag: - etag = entity.metadata.get("etag") + try: + etag = entity.metadata.get("etag", None) + except (AttributeError, TypeError): + pass if_match, _ = _get_match_headers( kwargs=dict( diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py index 5eabfa4a061d..d8250543613c 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_batch_async.py @@ -219,7 +219,7 @@ def update( if match_condition and not etag: try: etag = entity.metadata.get("etag", None) - except AttributeError: + except (AttributeError, TypeError): pass if_match, _ = _get_match_headers( @@ -498,7 +498,7 @@ def delete( if match_condition and not etag: try: etag = entity.metadata.get("etag", None) - except AttributeError: + except (AttributeError, TypeError): pass if_match, _ = _get_match_headers( 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 a08c9a9f24bf..539e80384066 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 @@ -319,7 +319,7 @@ async def delete_entity(self, *args: Union[TableEntity, str], **kwargs: Any) -> if match_condition and entity and not etag: try: etag = entity.metadata.get("etag", None) - except AttributeError: + except (AttributeError, TypeError): pass if_match, _ = _get_match_headers( @@ -413,18 +413,11 @@ async def update_entity( """ match_condition = kwargs.pop("match_condition", None) etag = kwargs.pop("etag", None) - if match_condition and not etag: - etag = entity.metadata.get("etag") - - if_match, _ = _get_match_headers( - kwargs=dict( - kwargs, - etag=etag, - match_condition=match_condition, - ), - etag_param="etag", - match_param="match_condition", - ) + if match_condition and entity and not etag: + try: + etag = entity.metadata.get("etag", None) + except (AttributeError, TypeError): + pass if_match, _ = _get_match_headers( kwargs=dict( diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_if_match_table_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_if_match_table_entity.yaml new file mode 100644 index 000000000000..f384755f05fe --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity.test_delete_entity_if_match_table_entity.yaml @@ -0,0 +1,278 @@ +interactions: +- request: + body: '{"TableName": "uttablebef617dd"}' + 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: + - Wed, 05 May 2021 17:32:01 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:01 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":"uttablebef617dd"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Wed, 05 May 2021 17:32:02 GMT + location: + - https://fake_table_account.table.core.windows.net/Tables('uttablebef617dd') + 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": "pkbef617dd", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rkbef617dd", "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: + - Wed, 05 May 2021 17:32:02 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:02 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttablebef617dd + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttablebef617dd/@Element","odata.etag":"W/\"datetime''2021-05-05T17%3A32%3A02.5872139Z''\"","PartitionKey":"pkbef617dd","RowKey":"rkbef617dd","Timestamp":"2021-05-05T17:32:02.5872139Z","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: + - Wed, 05 May 2021 17:32:02 GMT + etag: + - W/"datetime'2021-05-05T17%3A32%3A02.5872139Z'" + location: + - https://fake_table_account.table.core.windows.net/uttablebef617dd(PartitionKey='pkbef617dd',RowKey='rkbef617dd') + 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 + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 17:32:02 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:02 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttablebef617dd(PartitionKey='pkbef617dd',RowKey='rkbef617dd') + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttablebef617dd/@Element","odata.etag":"W/\"datetime''2021-05-05T17%3A32%3A02.5872139Z''\"","PartitionKey":"pkbef617dd","RowKey":"rkbef617dd","Timestamp":"2021-05-05T17:32:02.5872139Z","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: + - Wed, 05 May 2021 17:32:02 GMT + etag: + - W/"datetime'2021-05-05T17%3A32%3A02.5872139Z'" + 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;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 17:32:02 GMT + If-Match: + - W/"datetime'2021-05-05T17%3A32%3A02.5872139Z'" + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:02 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/uttablebef617dd(PartitionKey='pkbef617dd',RowKey='rkbef617dd') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 05 May 2021 17:32:02 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: + - Wed, 05 May 2021 17:32:02 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:02 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttablebef617dd(PartitionKey='pkbef617dd',RowKey='rkbef617dd') + response: + body: + string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:80084341-5002-003e-0ed4-414d5b000000\nTime:2021-05-05T17:32:02.9834948Z"}}}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Wed, 05 May 2021 17:32:02 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: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Wed, 05 May 2021 17:32:02 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:02 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttablebef617dd') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 05 May 2021 17:32:02 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_cosmos.test_delete_entity_if_match_table_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_delete_entity_if_match_table_entity.yaml new file mode 100644 index 000000000000..e3a4dc019cbc --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_entity_cosmos.test_delete_entity_if_match_table_entity.yaml @@ -0,0 +1,281 @@ +interactions: +- request: + body: '{"TableName": "uttable75661ad0"}' + 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: + - Wed, 05 May 2021 17:32:03 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:03 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable75661ad0","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Wed, 05 May 2021 17:32:03 GMT + etag: + - W/"datetime'2021-05-05T17%3A32%3A04.0869896Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable75661ad0') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Ok +- request: + body: '{"PartitionKey": "pk75661ad0", "PartitionKey@odata.type": "Edm.String", + "RowKey": "rk75661ad0", "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: + - Wed, 05 May 2021 17:32:04 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:04 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable75661ad0 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable75661ad0/$metadata#uttable75661ad0/@Element","odata.etag":"W/\"datetime''2021-05-05T17%3A32%3A04.6855176Z''\"","PartitionKey":"pk75661ad0","RowKey":"rk75661ad0","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-05T17:32:04.6855176Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Wed, 05 May 2021 17:32:03 GMT + etag: + - W/"datetime'2021-05-05T17%3A32%3A04.6855176Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttable75661ad0(PartitionKey='pk75661ad0',RowKey='rk75661ad0') + 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 + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 17:32:04 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:04 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable75661ad0(PartitionKey='pk75661ad0',RowKey='rk75661ad0') + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable75661ad0/$metadata#uttable75661ad0/@Element","odata.etag":"W/\"datetime''2021-05-05T17%3A32%3A04.6855176Z''\"","PartitionKey":"pk75661ad0","RowKey":"rk75661ad0","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-05T17:32:04.6855176Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Wed, 05 May 2021 17:32:03 GMT + etag: + - W/"datetime'2021-05-05T17%3A32%3A04.6855176Z'" + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: Ok +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + DataServiceVersion: + - '3.0' + Date: + - Wed, 05 May 2021 17:32:04 GMT + If-Match: + - W/"datetime'2021-05-05T17%3A32%3A04.6855176Z'" + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:04 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable75661ad0(PartitionKey='pk75661ad0',RowKey='rk75661ad0') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 05 May 2021 17:32:05 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: + - Wed, 05 May 2021 17:32:04 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:04 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable75661ad0(PartitionKey='pk75661ad0',RowKey='rk75661ad0') + response: + body: + string: "{\"odata.error\":{\"code\":\"ResourceNotFound\",\"message\":{\"lang\"\ + :\"en-us\",\"value\":\"The specified resource does not exist.\\nRequestID:cf160c34-adc7-11eb-bc48-002b67128e4c\\\ + n\"}}}\r\n" + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Wed, 05 May 2021 17:32:05 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Wed, 05 May 2021 17:32:05 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:05 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable75661ad0') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 05 May 2021 17:32:05 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: + - Wed, 05 May 2021 17:32:05 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Wed, 05 May 2021 17:32:05 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: + - Wed, 05 May 2021 17:32:05 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/test_table_entity.py b/sdk/tables/azure-data-tables/tests/test_table_entity.py index e122b116e062..001d4880d59e 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_entity.py +++ b/sdk/tables/azure-data-tables/tests/test_table_entity.py @@ -941,6 +941,29 @@ def test_get_entity_if_match_entity_bad_etag(self, tables_storage_account_name, finally: self._tear_down() + @tables_decorator + def test_delete_entity_if_match_table_entity(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, etag = self._insert_random_entity() + table_entity = TableEntity(**entity) + + entity = self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) + + with pytest.raises(ValueError): + self.table.delete_entity(table_entity, match_condition=MatchConditions.IfNotModified) + + self.table.delete_entity(table_entity, etag=etag, match_condition=MatchConditions.IfNotModified) + + with pytest.raises(ResourceNotFoundError): + self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + finally: + self._tear_down() + @tables_decorator def test_get_entity_full_metadata(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 6bba2a5424ad..2fb03808c62a 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 @@ -671,6 +671,29 @@ async def test_get_entity_if_match_entity_bad_etag(self, tables_storage_account_ finally: await self._tear_down() + @tables_decorator_async + async def test_delete_entity_if_match_table_entity(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, etag = await self._insert_random_entity() + table_entity = TableEntity(**entity) + + entity = await self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) + + with pytest.raises(ValueError): + await self.table.delete_entity(table_entity, match_condition=MatchConditions.IfNotModified) + + await self.table.delete_entity(table_entity, etag=etag, match_condition=MatchConditions.IfNotModified) + + with pytest.raises(ResourceNotFoundError): + await self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + + finally: + self._tear_down() @tables_decorator_async async def test_get_entity_full_metadata(self, tables_storage_account_name, tables_primary_storage_account_key): 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 dde8de80aa67..d731b44c97f5 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 @@ -902,6 +902,29 @@ def test_get_entity_if_match_entity_bad_etag(self, tables_cosmos_account_name, t finally: self._tear_down() + @cosmos_decorator + def test_delete_entity_if_match_table_entity(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, etag = self._insert_random_entity() + table_entity = TableEntity(**entity) + + entity = self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) + + with pytest.raises(ValueError): + self.table.delete_entity(table_entity, match_condition=MatchConditions.IfNotModified) + + self.table.delete_entity(table_entity, etag=etag, match_condition=MatchConditions.IfNotModified) + + with pytest.raises(ResourceNotFoundError): + self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + finally: + self._tear_down() + @cosmos_decorator def test_get_entity_full_metadata(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 a1c5d802c38e..f661514a37f4 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 @@ -616,7 +616,7 @@ async def test_get_entity_if_match(self, tables_cosmos_account_name, tables_prim finally: await self._tear_down() - @cosmos_decorator_async() + @cosmos_decorator_async async def test_get_entity_if_match_entity_bad_etag(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) @@ -640,6 +640,30 @@ async def test_get_entity_if_match_entity_bad_etag(self, tables_cosmos_account_n finally: await self._tear_down() + @cosmos_decorator_async + async def test_delete_entity_if_match_table_entity(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, etag = await self._insert_random_entity() + table_entity = TableEntity(**entity) + + entity = await self.table.get_entity( + partition_key=entity['PartitionKey'], + row_key=entity['RowKey'] + ) + + with pytest.raises(ValueError): + await self.table.delete_entity(table_entity, match_condition=MatchConditions.IfNotModified) + + await self.table.delete_entity(table_entity, etag=etag, match_condition=MatchConditions.IfNotModified) + + with pytest.raises(ResourceNotFoundError): + await self.table.get_entity(entity["PartitionKey"], entity["RowKey"]) + + finally: + self._tear_down() + @cosmos_decorator_async async def test_get_entity_full_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange From 9693a2e7050849b047d3b76911766a7bd2c82062 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Wed, 5 May 2021 13:59:17 -0400 Subject: [PATCH 5/5] unused overload --- sdk/tables/azure-data-tables/azure/data/tables/_table_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e115856a891f..96847adfd2fd 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, Type, Union, List, Tuple, Dict, Mapping, Iterable, overload +from typing import Optional, Any, Union, List, Tuple, Dict, Mapping, Iterable, overload try: from urllib.parse import urlparse, unquote except ImportError: