Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6ae6485
Add test resource creation scripts and gitignore
mccoyp Feb 2, 2021
f041790
Add synchronous test resource cleanup script
mccoyp Feb 2, 2021
0a1fc8f
Add functionality to shared test case classes
mccoyp Feb 2, 2021
c84d934
Refactor test_key_client.py to work with PowerShellPreparer
mccoyp Feb 2, 2021
02e4717
Remove MHSM URL fetching for this PR
mccoyp Feb 2, 2021
d8c7872
Update tests.yml to run resource creation script
mccoyp Feb 2, 2021
d9de9fc
Set hsm=True since KV SKU is premium
mccoyp Feb 2, 2021
8c7b238
Target async KeyClient in test_case_async.py
mccoyp Feb 2, 2021
0bce125
Refactor tests_keys_async.py
mccoyp Feb 2, 2021
78e80d8
Move client creation out of KeyVaultTestCase
mccoyp Feb 2, 2021
bbe8be7
Call load_dotenv in test-resources-cleanup.py
mccoyp Feb 2, 2021
de9ba74
Refactor crypto client tests
mccoyp Feb 3, 2021
f3918c9
Refactor crypto example tests
mccoyp Feb 3, 2021
dca8d65
Refactor sample tests
mccoyp Feb 3, 2021
8fcb360
Add test recordings
mccoyp Feb 3, 2021
a1d32eb
Refactor test_parse_id.py
mccoyp Feb 3, 2021
03b4bb5
create_client -> create_key_client in test_crypto_*.py
mccoyp Feb 4, 2021
07935a6
Show KeyType enum in test_samples_*.py
mccoyp Feb 4, 2021
184da0c
Remove cryptic test comment
mccoyp Feb 4, 2021
117fb78
create_client -> create_key_client in example tests
mccoyp Feb 4, 2021
5f21866
Clear HttpChallengeCache in test_crypto_client.py
mccoyp Feb 4, 2021
130c4c6
wip
mccoyp Feb 5, 2021
82c8d3e
Re-record to fix weird URL breaking
mccoyp Feb 5, 2021
70fefd4
Re-record all tests
mccoyp Feb 5, 2021
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
3 changes: 3 additions & 0 deletions sdk/keyvault/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.cer
*.key
*.pfx
8 changes: 6 additions & 2 deletions sdk/keyvault/azure-keyvault-keys/tests/_shared/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import time

from azure_devtools.scenario_tests.patches import patch_time_sleep_api
from devtools_testutils import AzureMgmtTestCase
from devtools_testutils import AzureTestCase


class KeyVaultTestCase(AzureMgmtTestCase):
class KeyVaultTestCase(AzureTestCase):
def __init__(self, *args, **kwargs):
if "match_body" not in kwargs:
kwargs["match_body"] = True
Expand All @@ -20,6 +20,10 @@ def setUp(self):
self.list_test_size = 7
super(KeyVaultTestCase, self).setUp()

def get_resource_name(self, name):
"""helper to create resources with a consistent, test-indicative prefix"""
return super(KeyVaultTestCase, self).get_resource_name("livekvtest{}".format(name))

def _poll_until_no_exception(self, fn, expected_exception, max_retries=20, retry_delay=3):
"""polling helper for live tests because some operations take an unpredictable amount of time to complete"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import asyncio

from azure_devtools.scenario_tests.patches import mock_in_unit_test
from devtools_testutils import AzureMgmtTestCase
from devtools_testutils import AzureTestCase


def skip_sleep(unit_test):
Expand All @@ -15,7 +15,7 @@ async def immediate_return(_):
return mock_in_unit_test(unit_test, "asyncio.sleep", immediate_return)


class KeyVaultTestCase(AzureMgmtTestCase):
class KeyVaultTestCase(AzureTestCase):
def __init__(self, *args, match_body=True, **kwargs):
super().__init__(*args, match_body=match_body, **kwargs)
self.replay_patches.append(skip_sleep)
Expand All @@ -24,6 +24,10 @@ def setUp(self):
self.list_test_size = 7
super(KeyVaultTestCase, self).setUp()

def get_resource_name(self, name):
"""helper to create resources with a consistent, test-indicative prefix"""
return super(KeyVaultTestCase, self).get_resource_name("livekvtest{}".format(name))

async def _poll_until_no_exception(self, fn, expected_exception, max_retries=20, retry_delay=3):
"""polling helper for live tests because some operations take an unpredictable amount of time to complete"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ interactions:
Content-Type:
- application/json
User-Agent:
- azsdk-python-keyvault-keys/4.3.1 Python/3.5.4 (Windows-10-10.0.19041-SP0)
- azsdk-python-keyvault-keys/4.3.2 Python/3.5.3 (Windows-10-10.0.19041-SP0)
method: POST
uri: https://vaultname.vault.azure.net/keys/eckeye9470d88/create?api-version=7.1
uri: https://vaultname.vault.azure.net/keys/livekvtesteckeye9470d88/create?api-version=7.1
response:
body:
string: '{"error":{"code":"Unauthorized","message":"Request is missing a Bearer
Expand All @@ -28,7 +28,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Wed, 02 Dec 2020 20:50:57 GMT
- Fri, 05 Feb 2021 09:22:43 GMT
expires:
- '-1'
pragma:
Expand All @@ -41,11 +41,11 @@ interactions:
x-content-type-options:
- nosniff
x-ms-keyvault-network-info:
- conn_type=Ipv4;addr=24.17.201.78;act_addr_fam=InterNetwork;
- conn_type=Ipv4;addr=174.127.232.53;act_addr_fam=InterNetwork;
x-ms-keyvault-region:
- westus
- northeurope
x-ms-keyvault-service-version:
- 1.2.80.0
- 1.2.139.0
x-powered-by:
- ASP.NET
status:
Expand All @@ -65,21 +65,21 @@ interactions:
Content-Type:
- application/json
User-Agent:
- azsdk-python-keyvault-keys/4.3.1 Python/3.5.4 (Windows-10-10.0.19041-SP0)
- azsdk-python-keyvault-keys/4.3.2 Python/3.5.3 (Windows-10-10.0.19041-SP0)
method: POST
uri: https://vaultname.vault.azure.net/keys/eckeye9470d88/create?api-version=7.1
uri: https://vaultname.vault.azure.net/keys/livekvtesteckeye9470d88/create?api-version=7.1
response:
body:
string: '{"key":{"kid":"https://vaultname.vault.azure.net/keys/eckeye9470d88/6e2cecdbf94c445e94f803e7718005be","kty":"EC","key_ops":["sign","verify"],"crv":"P-256","x":"JHuxTma0kqxGE158ricCGgzbYHx8wDoHFyiY_ew7LVs","y":"nkFZV0C0Mg-_ao0hkHY2Byx829BaSNEV_UBiRRgs8E4"},"attributes":{"enabled":true,"created":1606942258,"updated":1606942258,"recoveryLevel":"Recoverable+Purgeable","recoverableDays":90}}'
string: '{"key":{"kid":"https://vaultname.vault.azure.net/keys/livekvtesteckeye9470d88/6dce31df55584592889e82c031776bd4","kty":"EC","key_ops":["sign","verify"],"crv":"P-256","x":"vUWI_lv32aQTiVA2_OR2oisadpVzFahneR0XPXL8Fig","y":"OL4VpMY1_mTjbS1I6ij9Hu58xQb34wvskQQHwMKlONk"},"attributes":{"enabled":true,"created":1612516965,"updated":1612516965,"recoveryLevel":"Recoverable+Purgeable","recoverableDays":90}}'
headers:
cache-control:
- no-cache
content-length:
- '404'
- '402'
content-type:
- application/json; charset=utf-8
date:
- Wed, 02 Dec 2020 20:50:58 GMT
- Fri, 05 Feb 2021 09:22:44 GMT
expires:
- '-1'
pragma:
Expand All @@ -89,11 +89,11 @@ interactions:
x-content-type-options:
- nosniff
x-ms-keyvault-network-info:
- conn_type=Ipv4;addr=24.17.201.78;act_addr_fam=InterNetwork;
- conn_type=Ipv4;addr=174.127.232.53;act_addr_fam=InterNetwork;
x-ms-keyvault-region:
- westus
- northeurope
x-ms-keyvault-service-version:
- 1.2.80.0
- 1.2.139.0
x-powered-by:
- ASP.NET
status:
Expand All @@ -109,21 +109,21 @@ interactions:
Connection:
- keep-alive
User-Agent:
- azsdk-python-keyvault-keys/4.3.1 Python/3.5.4 (Windows-10-10.0.19041-SP0)
- azsdk-python-keyvault-keys/4.3.2 Python/3.5.3 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://vaultname.vault.azure.net/keys/eckeye9470d88/6e2cecdbf94c445e94f803e7718005be?api-version=7.1
uri: https://vaultname.vault.azure.net/keys/livekvtesteckeye9470d88/6dce31df55584592889e82c031776bd4?api-version=7.1
response:
body:
string: '{"key":{"kid":"https://vaultname.vault.azure.net/keys/eckeye9470d88/6e2cecdbf94c445e94f803e7718005be","kty":"EC","key_ops":["sign","verify"],"crv":"P-256","x":"JHuxTma0kqxGE158ricCGgzbYHx8wDoHFyiY_ew7LVs","y":"nkFZV0C0Mg-_ao0hkHY2Byx829BaSNEV_UBiRRgs8E4"},"attributes":{"enabled":true,"created":1606942258,"updated":1606942258,"recoveryLevel":"Recoverable+Purgeable","recoverableDays":90}}'
string: '{"key":{"kid":"https://vaultname.vault.azure.net/keys/livekvtesteckeye9470d88/6dce31df55584592889e82c031776bd4","kty":"EC","key_ops":["sign","verify"],"crv":"P-256","x":"vUWI_lv32aQTiVA2_OR2oisadpVzFahneR0XPXL8Fig","y":"OL4VpMY1_mTjbS1I6ij9Hu58xQb34wvskQQHwMKlONk"},"attributes":{"enabled":true,"created":1612516965,"updated":1612516965,"recoveryLevel":"Recoverable+Purgeable","recoverableDays":90}}'
headers:
cache-control:
- no-cache
content-length:
- '404'
- '402'
content-type:
- application/json; charset=utf-8
date:
- Wed, 02 Dec 2020 20:50:59 GMT
- Fri, 05 Feb 2021 09:22:46 GMT
expires:
- '-1'
pragma:
Expand All @@ -133,11 +133,11 @@ interactions:
x-content-type-options:
- nosniff
x-ms-keyvault-network-info:
- conn_type=Ipv4;addr=24.17.201.78;act_addr_fam=InterNetwork;
- conn_type=Ipv4;addr=174.127.232.53;act_addr_fam=InterNetwork;
x-ms-keyvault-region:
- westus
- northeurope
x-ms-keyvault-service-version:
- 1.2.80.0
- 1.2.139.0
x-powered-by:
- ASP.NET
status:
Expand Down
Loading