Skip to content

Commit

Permalink
Auto-applying across test class
Browse files Browse the repository at this point in the history
  • Loading branch information
mccoyp committed Jul 15, 2022
1 parent 1094e4d commit 71206d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
19 changes: 1 addition & 18 deletions sdk/keyvault/azure-keyvault-keys/tests/test_key_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def emit(self, record):
self.messages.append(record)


@pytest.mark.usefixtures("recorded_test", "variable_recorder")
class TestKeyClient(KeyVaultTestCase, KeysTestCase):
def _assert_jwks_equal(self, jwk1, jwk2):
for field in JsonWebKey._FIELDS:
Expand Down Expand Up @@ -177,7 +178,6 @@ def _to_bytes(hex):

@pytest.mark.parametrize("api_version,is_hsm",all_api_versions)
@KeysClientPreparer()
@recorded_by_proxy
def test_key_crud_operations(self, client, is_hsm, **kwargs):
set_bodiless_matcher()
assert client is not None
Expand Down Expand Up @@ -242,7 +242,6 @@ def test_key_crud_operations(self, client, is_hsm, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",only_hsm)
@KeysClientPreparer()
@recorded_by_proxy
def test_rsa_public_exponent(self, client, **kwargs):
"""The public exponent of a Managed HSM RSA key can be specified during creation"""
set_bodiless_matcher()
Expand All @@ -255,7 +254,6 @@ def test_rsa_public_exponent(self, client, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",all_api_versions)
@KeysClientPreparer()
@recorded_by_proxy
def test_backup_restore(self, client, is_hsm, **kwargs):
set_bodiless_matcher()
assert client is not None
Expand All @@ -282,7 +280,6 @@ def test_backup_restore(self, client, is_hsm, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",all_api_versions)
@KeysClientPreparer()
@recorded_by_proxy
def test_key_list(self, client, is_hsm, **kwargs):
set_bodiless_matcher()

Expand All @@ -307,7 +304,6 @@ def test_key_list(self, client, is_hsm, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",all_api_versions)
@KeysClientPreparer()
@recorded_by_proxy
def test_list_versions(self, client, is_hsm, **kwargs):
assert client is not None

Expand All @@ -333,7 +329,6 @@ def test_list_versions(self, client, is_hsm, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",all_api_versions)
@KeysClientPreparer()
@recorded_by_proxy
def test_list_deleted_keys(self, client, is_hsm, **kwargs):
set_bodiless_matcher()
assert client is not None
Expand Down Expand Up @@ -364,7 +359,6 @@ def test_list_deleted_keys(self, client, is_hsm, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",all_api_versions)
@KeysClientPreparer()
@recorded_by_proxy
def test_recover(self, client, is_hsm, **kwargs):
set_bodiless_matcher()
assert client is not None
Expand All @@ -391,7 +385,6 @@ def test_recover(self, client, is_hsm, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",all_api_versions)
@KeysClientPreparer()
@recorded_by_proxy
def test_purge(self, client, is_hsm, **kwargs):
set_bodiless_matcher()
assert client is not None
Expand Down Expand Up @@ -423,7 +416,6 @@ def test_purge(self, client, is_hsm, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",logging_enabled)
@KeysClientPreparer(logging_enable = True)
@recorded_by_proxy
def test_logging_enabled(self, client, is_hsm, **kwargs):
mock_handler = MockHandler()

Expand Down Expand Up @@ -458,7 +450,6 @@ def test_logging_enabled(self, client, is_hsm, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",logging_enabled)
@KeysClientPreparer(logging_enable = False)
@recorded_by_proxy
def test_logging_disabled(self, client, is_hsm, **kwargs):
mock_handler = MockHandler()

Expand Down Expand Up @@ -492,7 +483,6 @@ def test_logging_disabled(self, client, is_hsm, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",only_hsm_7_3)
@KeysClientPreparer()
@recorded_by_proxy
def test_get_random_bytes(self, client, **kwargs):
assert client

Expand All @@ -508,7 +498,6 @@ def test_get_random_bytes(self, client, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",only_7_3)
@KeysClientPreparer()
@recorded_by_proxy
def test_key_release(self, client, **kwargs):
set_bodiless_matcher()
attestation_uri = self._get_attestation_uri()
Expand All @@ -528,7 +517,6 @@ def test_key_release(self, client, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",only_hsm_7_3)
@KeysClientPreparer()
@recorded_by_proxy
def test_imported_key_release(self, client, **kwargs):
set_bodiless_matcher()
attestation_uri = self._get_attestation_uri()
Expand All @@ -548,7 +536,6 @@ def test_imported_key_release(self, client, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",only_7_3)
@KeysClientPreparer()
@recorded_by_proxy
def test_update_release_policy(self, client, **kwargs):
set_bodiless_matcher()
attestation_uri = self._get_attestation_uri()
Expand Down Expand Up @@ -590,7 +577,6 @@ def test_update_release_policy(self, client, **kwargs):
#Immutable policies aren't currently supported on Managed HSM
@pytest.mark.parametrize("api_version,is_hsm",only_vault_7_3)
@KeysClientPreparer()
@recorded_by_proxy
def test_immutable_release_policy(self, client, **kwargs):
set_bodiless_matcher()
attestation_uri = self._get_attestation_uri()
Expand Down Expand Up @@ -624,7 +610,6 @@ def test_immutable_release_policy(self, client, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",only_vault_7_3)
@KeysClientPreparer()
@recorded_by_proxy
def test_key_rotation(self, client, **kwargs):
set_bodiless_matcher()
if (not is_public_cloud() and self.is_live):
Expand All @@ -641,7 +626,6 @@ def test_key_rotation(self, client, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",only_vault_7_3)
@KeysClientPreparer()
@recorded_by_proxy
def test_key_rotation_policy(self, client, **kwargs):
set_bodiless_matcher()
if (not is_public_cloud() and self.is_live):
Expand Down Expand Up @@ -709,7 +693,6 @@ def test_key_rotation_policy(self, client, **kwargs):

@pytest.mark.parametrize("api_version,is_hsm",all_api_versions)
@KeysClientPreparer()
@recorded_by_proxy
def test_get_cryptography_client(self, client, is_hsm, **kwargs):
key_name = self.get_resource_name("key-name")
key = self._create_rsa_key(client, key_name, hardware_protected=is_hsm)
Expand Down
8 changes: 3 additions & 5 deletions sdk/tables/azure-data-tables/tests/test_table_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,9 @@ def test_batch_update_if_doesnt_match(self, tables_storage_account_name, tables_
@tables_decorator_with_wraps
def test_batch_single_op_if_doesnt_match(self, variable_recorder, tables_storage_account_name=None, tables_primary_storage_account_key=None):
# this can be reverted to set_bodiless_matcher() after tests are re-recorded and don't contain these headers
# set_custom_default_matcher(
# compare_bodies=False, excluded_headers="Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id"
# )

# Above section is intentionally commented to trigger a playback error, to show how error raising is handled
set_custom_default_matcher(
compare_bodies=False, excluded_headers="Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id"
)

# variable_recorder directly returns the dictionary containing recorded variables. In live mode, this is an
# empty dictionary; in playback mode, this is populated with any variables that were recorded previously.
Expand Down

0 comments on commit 71206d6

Please sign in to comment.