diff --git a/sdk/keyvault/azure-keyvault-keys/tests/test_key_client.py b/sdk/keyvault/azure-keyvault-keys/tests/test_key_client.py index ed0caf5f9f0b..a72ba573f4d8 100644 --- a/sdk/keyvault/azure-keyvault-keys/tests/test_key_client.py +++ b/sdk/keyvault/azure-keyvault-keys/tests/test_key_client.py @@ -6,25 +6,29 @@ import functools import json import logging +import os import time import pytest -from azure.core.exceptions import (HttpResponseError, ResourceExistsError, - ResourceNotFoundError) +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError from azure.core.pipeline.policies import SansIOHTTPPolicy -from azure.keyvault.keys import (ApiVersion, JsonWebKey, KeyClient, - KeyReleasePolicy, KeyRotationLifetimeAction, - KeyRotationPolicy, KeyRotationPolicyAction, - KeyType) -from azure.keyvault.keys._generated.v7_3.models import \ - KeyRotationPolicy as _KeyRotationPolicy +from azure.keyvault.keys import ( + ApiVersion, + JsonWebKey, + KeyClient, + KeyReleasePolicy, + KeyRotationLifetimeAction, + KeyRotationPolicy, + KeyRotationPolicyAction, + KeyType +) +from azure.keyvault.keys._generated.v7_3.models import KeyRotationPolicy as _KeyRotationPolicy from dateutil import parser as date_parse from devtools_testutils import recorded_by_proxy, set_bodiless_matcher from six import byte2int from _shared.test_case import KeyVaultTestCase -from _test_case import (KeysClientPreparer, get_attestation_token, - get_decorator, get_release_policy, is_public_cloud) +from _test_case import KeysClientPreparer, get_attestation_token, get_decorator, get_release_policy, is_public_cloud from _keys_test_case import KeysTestCase @@ -510,6 +514,9 @@ def test_get_random_bytes(self, client, **kwargs): @KeysClientPreparer() @recorded_by_proxy def test_key_release(self, client, **kwargs): + if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"): + pytest.skip("This test is not supported on standard SKU vaults. Follow up with service team") + set_bodiless_matcher() attestation_uri = self._get_attestation_uri() attestation = get_attestation_token(attestation_uri) @@ -550,6 +557,9 @@ def test_imported_key_release(self, client, **kwargs): @KeysClientPreparer() @recorded_by_proxy def test_update_release_policy(self, client, **kwargs): + if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"): + pytest.skip("This test is not supported on standard SKU vaults. Follow up with service team") + set_bodiless_matcher() attestation_uri = self._get_attestation_uri() release_policy = get_release_policy(attestation_uri) @@ -592,6 +602,9 @@ def test_update_release_policy(self, client, **kwargs): @KeysClientPreparer() @recorded_by_proxy def test_immutable_release_policy(self, client, **kwargs): + if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"): + pytest.skip("This test is not supported on standard SKU vaults. Follow up with service team") + set_bodiless_matcher() attestation_uri = self._get_attestation_uri() release_policy = get_release_policy(attestation_uri, immutable=True) @@ -626,10 +639,10 @@ def test_immutable_release_policy(self, client, **kwargs): @KeysClientPreparer() @recorded_by_proxy def test_key_rotation(self, client, **kwargs): - set_bodiless_matcher() if (not is_public_cloud() and self.is_live): - pytest.skip("This test not supprot in usgov/china region. Follow up with service team.") + pytest.skip("This test is not supported in usgov/china region. Follow up with service team.") + set_bodiless_matcher() key_name = self.get_resource_name("rotation-key") key = self._create_rsa_key(client, key_name) rotated_key = client.rotate_key(key_name) @@ -643,10 +656,10 @@ def test_key_rotation(self, client, **kwargs): @KeysClientPreparer() @recorded_by_proxy def test_key_rotation_policy(self, client, **kwargs): - set_bodiless_matcher() if (not is_public_cloud() and self.is_live): - pytest.skip("This test not supprot in usgov/china region. Follow up with service team.") + pytest.skip("This test is not supported in usgov/china region. Follow up with service team.") + set_bodiless_matcher() key_name = self.get_resource_name("rotation-key") self._create_rsa_key(client, key_name) diff --git a/sdk/keyvault/azure-keyvault-keys/tests/test_keys_async.py b/sdk/keyvault/azure-keyvault-keys/tests/test_keys_async.py index 666c5ed63db6..a06c7f550c8b 100644 --- a/sdk/keyvault/azure-keyvault-keys/tests/test_keys_async.py +++ b/sdk/keyvault/azure-keyvault-keys/tests/test_keys_async.py @@ -8,6 +8,7 @@ import functools import json import logging +import os from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError from azure.core.pipeline.policies import SansIOHTTPPolicy @@ -515,6 +516,9 @@ async def test_get_random_bytes(self, client, **kwargs): @AsyncKeysClientPreparer() @recorded_by_proxy_async async def test_key_release(self, client, **kwargs): + if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"): + pytest.skip("This test is not supported on standard SKU vaults. Follow up with service team") + set_bodiless_matcher() attestation_uri = self._get_attestation_uri() attestation = await get_attestation_token(attestation_uri) @@ -557,6 +561,9 @@ async def test_imported_key_release(self, client, **kwargs): @AsyncKeysClientPreparer() @recorded_by_proxy_async async def test_update_release_policy(self, client, **kwargs): + if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"): + pytest.skip("This test is not supported on standard SKU vaults. Follow up with service team") + set_bodiless_matcher() attestation_uri = self._get_attestation_uri() release_policy = get_release_policy(attestation_uri) @@ -600,6 +607,9 @@ async def test_update_release_policy(self, client, **kwargs): @AsyncKeysClientPreparer() @recorded_by_proxy_async async def test_immutable_release_policy(self, client, **kwargs): + if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"): + pytest.skip("This test is not supported on standard SKU vaults. Follow up with service team") + set_bodiless_matcher() attestation_uri = self._get_attestation_uri() release_policy = get_release_policy(attestation_uri, immutable=True) @@ -635,10 +645,10 @@ async def test_immutable_release_policy(self, client, **kwargs): @AsyncKeysClientPreparer() @recorded_by_proxy_async async def test_key_rotation(self, client, **kwargs): - set_bodiless_matcher() if (not is_public_cloud() and self.is_live): - pytest.skip("This test not supprot in usgov/china region. Follow up with service team.") + pytest.skip("This test is not supported in usgov/china region. Follow up with service team.") + set_bodiless_matcher() key_name = self.get_resource_name("rotation-key") key = await self._create_rsa_key(client, key_name) rotated_key = await client.rotate_key(key_name) @@ -653,10 +663,10 @@ async def test_key_rotation(self, client, **kwargs): @AsyncKeysClientPreparer() @recorded_by_proxy_async async def test_key_rotation_policy(self, client, **kwargs): - set_bodiless_matcher() if (not is_public_cloud() and self.is_live): - pytest.skip("This test not supprot in usgov/china region. Follow up with service team.") + pytest.skip("This test is not supported in usgov/china region. Follow up with service team.") + set_bodiless_matcher() key_name = self.get_resource_name("rotation-key") await self._create_rsa_key(client, key_name) diff --git a/sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys.py b/sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys.py index 315e4c567b8e..f48237d31824 100644 --- a/sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys.py +++ b/sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys.py @@ -42,7 +42,7 @@ class TestExamplesKeyVault(KeyVaultTestCase, KeysTestCase): @recorded_by_proxy def test_example_key_crud_operations(self, key_client, **kwargs): if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"): - pytest.skip("This test not supprot in usgov/china region. Follow up with service team") + pytest.skip("This test is not supported on standard SKU vaults. Follow up with service team") key_name = self.get_resource_name("key-name") diff --git a/sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys_async.py b/sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys_async.py index 1e595df6ecb5..c4cc017ee476 100644 --- a/sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys_async.py +++ b/sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys_async.py @@ -46,7 +46,7 @@ class TestExamplesKeyVault(KeyVaultTestCase): @recorded_by_proxy_async async def test_example_key_crud_operations(self, key_client, **kwargs): if (self.is_live and os.environ["KEYVAULT_SKU"] != "premium"): - pytest.skip("This test not supprot in usgov/china region. Follow up with service team") + pytest.skip("This test is not supported on standard SKU vaults. Follow up with service team") key_name = self.get_resource_name("key-name")