Skip to content

Commit

Permalink
Custom hook policy test classes subclasses SansIOHTTPPolicy (#16784)
Browse files Browse the repository at this point in the history
  • Loading branch information
chlowell authored Feb 17, 2021
1 parent 7272bb5 commit a904295
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pytest

from azure.core.exceptions import ResourceExistsError
from azure.core.pipeline.policies import SansIOHTTPPolicy
from azure_devtools.scenario_tests import RecordingProcessor, RequestUrlNormalizer

from azure.keyvault.certificates import (
Expand Down Expand Up @@ -698,7 +699,7 @@ def test_service_headers_allowed_in_logs():


def test_custom_hook_policy():
class CustomHookPolicy(object):
class CustomHookPolicy(SansIOHTTPPolicy):
pass

client = CertificateClient("...", object(), custom_hook_policy=CustomHookPolicy())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import json

from azure.core.exceptions import ResourceExistsError
from azure.core.pipeline.policies import SansIOHTTPPolicy
from azure_devtools.scenario_tests import RecordingProcessor
from azure.keyvault.certificates import (
AdministratorContact,
Expand Down Expand Up @@ -708,7 +709,7 @@ def test_service_headers_allowed_in_logs():


def test_custom_hook_policy():
class CustomHookPolicy(object):
class CustomHookPolicy(SansIOHTTPPolicy):
pass

client = CertificateClient("...", object(), custom_hook_policy=CustomHookPolicy())
Expand Down
3 changes: 2 additions & 1 deletion sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import mock

from azure.core.exceptions import HttpResponseError
from azure.core.pipeline.policies import SansIOHTTPPolicy
from azure.keyvault.keys import JsonWebKey, KeyClient, KeyCurveName, KeyType, KeyVaultKey
from azure.keyvault.keys.crypto import CryptographyClient, EncryptionAlgorithm, KeyWrapAlgorithm, SignatureAlgorithm
from azure.keyvault.keys.crypto._key_validity import _UTC
Expand Down Expand Up @@ -382,7 +383,7 @@ def test_operations(key, expected_error_substrings, encrypt_algorithms, wrap_alg


def test_custom_hook_policy():
class CustomHookPolicy(object):
class CustomHookPolicy(SansIOHTTPPolicy):
pass

client = CryptographyClient("https://localhost/fake/key/version", object(), custom_hook_policy=CustomHookPolicy())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from unittest import mock

from azure.core.exceptions import HttpResponseError
from azure.core.pipeline.policies import SansIOHTTPPolicy
from azure.keyvault.keys import JsonWebKey, KeyCurveName, KeyVaultKey
from azure.keyvault.keys.aio import KeyClient
from azure.keyvault.keys.crypto._key_validity import _UTC
Expand Down Expand Up @@ -379,7 +380,7 @@ async def test_operations(key, expected_error_substrings, encrypt_algorithms, wr


def test_custom_hook_policy():
class CustomHookPolicy(object):
class CustomHookPolicy(SansIOHTTPPolicy):
pass

client = CryptographyClient("https://localhost/fake/key/version", object(), custom_hook_policy=CustomHookPolicy())
Expand Down
3 changes: 2 additions & 1 deletion sdk/keyvault/azure-keyvault-keys/tests/test_key_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import json

from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError
from azure.core.pipeline.policies import SansIOHTTPPolicy
from azure.keyvault.keys import JsonWebKey, KeyClient
from azure.keyvault.keys._shared import HttpChallengeCache
from devtools_testutils import PowerShellPreparer
Expand Down Expand Up @@ -416,7 +417,7 @@ def test_service_headers_allowed_in_logs():


def test_custom_hook_policy():
class CustomHookPolicy(object):
class CustomHookPolicy(SansIOHTTPPolicy):
pass

client = KeyClient("...", object(), custom_hook_policy=CustomHookPolicy())
Expand Down
3 changes: 2 additions & 1 deletion sdk/keyvault/azure-keyvault-keys/tests/test_keys_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from dateutil import parser as date_parse

from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError
from azure.core.pipeline.policies import SansIOHTTPPolicy
from azure.keyvault.keys import JsonWebKey
from azure.keyvault.keys.aio import KeyClient
from azure.keyvault.keys._shared import HttpChallengeCache
Expand Down Expand Up @@ -441,7 +442,7 @@ def test_service_headers_allowed_in_logs():


def test_custom_hook_policy():
class CustomHookPolicy(object):
class CustomHookPolicy(SansIOHTTPPolicy):
pass

client = KeyClient("...", object(), custom_hook_policy=CustomHookPolicy())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import json

from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError
from azure.core.pipeline.policies import SansIOHTTPPolicy
from azure.keyvault.secrets.aio import SecretClient
from devtools_testutils import ResourceGroupPreparer, KeyVaultPreparer

Expand Down Expand Up @@ -334,7 +335,7 @@ def test_service_headers_allowed_in_logs():


def test_custom_hook_policy():
class CustomHookPolicy(object):
class CustomHookPolicy(SansIOHTTPPolicy):
pass

client = SecretClient("...", object(), custom_hook_policy=CustomHookPolicy())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import json

from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError
from azure.core.pipeline.policies import SansIOHTTPPolicy
from azure.keyvault.secrets import SecretClient
from devtools_testutils import ResourceGroupPreparer, KeyVaultPreparer

Expand Down Expand Up @@ -341,7 +342,7 @@ def test_service_headers_allowed_in_logs():


def test_custom_hook_policy():
class CustomHookPolicy(object):
class CustomHookPolicy(SansIOHTTPPolicy):
pass

client = SecretClient("...", object(), custom_hook_policy=CustomHookPolicy())
Expand Down

0 comments on commit a904295

Please sign in to comment.