Skip to content

Commit

Permalink
If match headers (Azure#13315)
Browse files Browse the repository at this point in the history
* verifying match conditions are correct, adding tests for other conditions

* changes to verify etag is working, think it's being ignored by service

* another change to test file, passing the correct etag to the service, it returns a 204 so no error is produced

* renaming vars

* testing for if-match conditions to make sure they are properly parsed and sent to service

* reverting header back

* testing update to reflect new response in create_entity
  • Loading branch information
seankane-msft authored and rakshith91 committed Sep 4, 2020
1 parent 6ab1624 commit 5db741c
Show file tree
Hide file tree
Showing 9 changed files with 1,948 additions and 51 deletions.
2 changes: 2 additions & 0 deletions sdk/tables/azure-data-tables/azure/data/tables/_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def _get_match_headers(kwargs, match_param, etag_param):
raise ValueError("'{}' specified without '{}'.".format(match_param, etag_param))
elif match_condition == MatchConditions.IfMissing:
if_none_match = '*'
elif match_condition == MatchConditions.Unconditionally:
if_none_match = '*'
elif match_condition is None:
if kwargs.get(etag_param):
raise ValueError("'{}' specified without '{}'.".format(etag_param, match_param))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def delete_entity(
if_match, _ = _get_match_headers(kwargs=dict(kwargs, etag=kwargs.pop('etag', None),
match_condition=kwargs.pop('match_condition', None)),
etag_param='etag', match_param='match_condition')

try:
self._client.table.delete_entity(
table=self.table_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,49 @@ interactions:
status:
code: 204
message: No Content
- request:
body: null
headers:
Accept:
- application/json;odata=minimalmetadata
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
DataServiceVersion:
- '3.0'
Date:
- Tue, 25 Aug 2020 15:09:34 GMT
User-Agent:
- azsdk-python-data-tables/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Tue, 25 Aug 2020 15:09:34 GMT
x-ms-version:
- '2019-07-07'
method: GET
uri: https://storagename.table.core.windows.net/uttable74691147(PartitionKey='pk74691147',RowKey='rk74691147')
response:
body:
string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The
specified resource does not exist.\nRequestId:32d896fc-f002-0081-26f1-7abf70000000\nTime:2020-08-25T15:09:35.2385928Z"}}}'
headers:
cache-control:
- no-cache
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Tue, 25 Aug 2020 15:09:34 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-ms-version:
- '2019-07-07'
status:
code: 404
message: Not Found
- request:
body: null
headers:
Expand Down
Loading

0 comments on commit 5db741c

Please sign in to comment.