Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move credential and header policies after retry policy #14629

Merged
merged 8 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,16 @@ def _create_pipeline(self, credential, **kwargs):
config.transport = RequestsTransport(**kwargs)
policies = [
QueueMessagePolicy(),
config.headers_policy,
config.proxy_policy,
config.user_agent_policy,
StorageContentValidation(),
StorageRequestHook(**kwargs),
self._credential_policy,
ContentDecodePolicy(response_encoding="utf-8"),
RedirectPolicy(**kwargs),
StorageHosts(hosts=self._hosts, **kwargs),
config.retry_policy,
config.headers_policy,
StorageRequestHook(**kwargs),
tasherif-msft marked this conversation as resolved.
Show resolved Hide resolved
self._credential_policy,
config.logging_policy,
StorageResponseHook(**kwargs),
DistributedTracingPolicy(**kwargs),
Expand Down
2 changes: 2 additions & 0 deletions sdk/storage/azure-storage-blob/tests/_shared/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ class FakeTokenCredential(object):
"""
def __init__(self):
self.token = AccessToken("YOU SHALL NOT PASS", 0)
self.get_token_count = 0

def get_token(self, *args):
self.get_token_count += 1
return self.token


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ interactions:
Content-Length:
- '0'
User-Agent:
- azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- azsdk-python-storage-blob/12.6.0b2 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Fri, 25 Oct 2019 17:22:10 GMT
- Tue, 20 Oct 2020 05:00:23 GMT
x-ms-version:
- '2019-02-02'
- '2020-02-10'
method: PUT
uri: https://storagename.blob.core.windows.net/utcontainer751d1669?restype=container
response:
Expand All @@ -25,15 +25,15 @@ interactions:
content-length:
- '0'
date:
- Fri, 25 Oct 2019 17:22:10 GMT
- Tue, 20 Oct 2020 05:00:23 GMT
etag:
- '"0x8D7596FDEBA1CFB"'
- '"0x8D874B50D923DE7"'
last-modified:
- Fri, 25 Oct 2019 17:22:10 GMT
- Tue, 20 Oct 2020 05:00:23 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-version:
- '2019-02-02'
- '2020-02-10'
status:
code: 201
message: Created
Expand All @@ -53,13 +53,13 @@ interactions:
If-None-Match:
- '*'
User-Agent:
- azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- azsdk-python-storage-blob/12.6.0b2 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-blob-type:
- BlockBlob
x-ms-date:
- Fri, 25 Oct 2019 17:22:11 GMT
- Tue, 20 Oct 2020 05:00:24 GMT
x-ms-version:
- '2019-02-02'
- '2020-02-10'
method: PUT
uri: https://storagename.blob.core.windows.net/utcontainer751d1669/blob1
response:
Expand All @@ -71,19 +71,19 @@ interactions:
content-md5:
- XrY7u+Ae7tCTyyK7j1rNww==
date:
- Fri, 25 Oct 2019 17:22:10 GMT
- Tue, 20 Oct 2020 05:00:23 GMT
etag:
- '"0x8D7596FDEC2F348"'
- '"0x8D874B50DA843F8"'
last-modified:
- Fri, 25 Oct 2019 17:22:10 GMT
- Tue, 20 Oct 2020 05:00:23 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-content-crc64:
- vo7q9sPVKY0=
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- '2019-02-02'
- '2020-02-10'
status:
code: 201
message: Created
Expand All @@ -97,11 +97,11 @@ interactions:
Connection:
- keep-alive
User-Agent:
- azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- azsdk-python-storage-blob/12.6.0b2 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Fri, 25 Oct 2019 17:22:11 GMT
- Tue, 20 Oct 2020 05:00:24 GMT
x-ms-version:
- '2019-02-02'
- '2020-02-10'
method: HEAD
uri: https://storagename.blob.core.windows.net/utcontainer751d1669/blob1
response:
Expand All @@ -117,11 +117,11 @@ interactions:
content-type:
- application/octet-stream
date:
- Fri, 25 Oct 2019 17:22:11 GMT
- Tue, 20 Oct 2020 05:00:23 GMT
etag:
- '"0x8D7596FDEC2F348"'
- '"0x8D874B50DA843F8"'
last-modified:
- Fri, 25 Oct 2019 17:22:10 GMT
- Tue, 20 Oct 2020 05:00:23 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-access-tier:
Expand All @@ -131,15 +131,17 @@ interactions:
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Fri, 25 Oct 2019 17:22:10 GMT
- Tue, 20 Oct 2020 05:00:23 GMT
x-ms-last-access-time:
- Tue, 20 Oct 2020 05:00:23 GMT
x-ms-lease-state:
- available
x-ms-lease-status:
- unlocked
x-ms-server-encrypted:
- 'true'
x-ms-version:
- '2019-02-02'
- '2020-02-10'
status:
code: 200
message: OK
Expand All @@ -153,15 +155,15 @@ interactions:
Connection:
- keep-alive
If-Match:
- '"0x8D7596FDEC2F348"'
- '"0x8D874B50DA843F8"'
User-Agent:
- azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
- azsdk-python-storage-blob/12.6.0b2 Python/3.8.5 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Fri, 25 Oct 2019 17:22:11 GMT
- Tue, 20 Oct 2020 05:00:24 GMT
x-ms-range:
- bytes=0-33554431
x-ms-version:
- '2019-02-02'
- '2020-02-10'
method: GET
uri: https://storagename.blob.core.windows.net/utcontainer751d1669/blob1
response:
Expand All @@ -177,27 +179,29 @@ interactions:
content-type:
- application/octet-stream
date:
- Fri, 25 Oct 2019 17:22:11 GMT
- Tue, 20 Oct 2020 05:00:23 GMT
etag:
- '"0x8D7596FDEC2F348"'
- '"0x8D874B50DA843F8"'
last-modified:
- Fri, 25 Oct 2019 17:22:10 GMT
- Tue, 20 Oct 2020 05:00:23 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-blob-content-md5:
- XrY7u+Ae7tCTyyK7j1rNww==
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- Fri, 25 Oct 2019 17:22:10 GMT
- Tue, 20 Oct 2020 05:00:23 GMT
x-ms-last-access-time:
- Tue, 20 Oct 2020 05:00:23 GMT
x-ms-lease-state:
- available
x-ms-lease-status:
- unlocked
x-ms-server-encrypted:
- 'true'
x-ms-version:
- '2019-02-02'
- '2020-02-10'
status:
code: 206
message: Partial Content
Expand Down
Loading