Skip to content

Commit

Permalink
[Key Vault] Test certificates library against a shared vault (#16792)
Browse files Browse the repository at this point in the history
  • Loading branch information
mccoyp authored Feb 18, 2021
1 parent b9fe720 commit 80c3b8e
Show file tree
Hide file tree
Showing 60 changed files with 9,474 additions and 20,623 deletions.
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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interactions:
Content-Type:
- application/json
User-Agent:
- azsdk-python-keyvault-certificates/4.2.0b2 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
- azsdk-python-keyvault-certificates/4.2.2 Python/3.5.3 (Windows-10-10.0.19041-SP0)
method: PUT
uri: https://vaultname.vault.azure.net/certificates/contacts?api-version=7.1
response:
Expand All @@ -28,7 +28,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Wed, 29 Jul 2020 17:51:52 GMT
- Wed, 17 Feb 2021 01:33:34 GMT
expires:
- '-1'
pragma:
Expand All @@ -38,25 +38,23 @@ interactions:
www-authenticate:
- Bearer authorization="https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47",
resource="https://vault.azure.net"
x-aspnet-version:
- 4.0.30319
x-content-type-options:
- nosniff
x-ms-keyvault-network-info:
- conn_type=Ipv4;addr=73.135.72.237;act_addr_fam=InterNetwork;
- conn_type=Ipv4;addr=174.127.232.53;act_addr_fam=InterNetwork;
x-ms-keyvault-region:
- westus
- westus2
x-ms-keyvault-service-version:
- 1.1.10.0
- 1.2.164.2
x-powered-by:
- ASP.NET
status:
code: 401
message: Unauthorized
- request:
body: '{"contacts": [{"email": "admin@contoso.com", "name": "John Doe", "phone":
"1111111111"}, {"email": "admin2@contoso.com", "name": "John Doe2", "phone":
"2222222222"}]}'
body: '{"contacts": [{"phone": "1111111111", "email": "admin@contoso.com", "name":
"John Doe"}, {"phone": "2222222222", "email": "admin2@contoso.com", "name":
"John Doe2"}]}'
headers:
Accept:
- application/json
Expand All @@ -69,7 +67,7 @@ interactions:
Content-Type:
- application/json
User-Agent:
- azsdk-python-keyvault-certificates/4.2.0b2 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
- azsdk-python-keyvault-certificates/4.2.2 Python/3.5.3 (Windows-10-10.0.19041-SP0)
method: PUT
uri: https://vaultname.vault.azure.net/certificates/contacts?api-version=7.1
response:
Expand All @@ -80,27 +78,25 @@ interactions:
cache-control:
- no-cache
content-length:
- '232'
- '218'
content-type:
- application/json; charset=utf-8
date:
- Wed, 29 Jul 2020 17:51:52 GMT
- Wed, 17 Feb 2021 01:33:34 GMT
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000;includeSubDomains
x-aspnet-version:
- 4.0.30319
x-content-type-options:
- nosniff
x-ms-keyvault-network-info:
- conn_type=Ipv4;addr=73.135.72.237;act_addr_fam=InterNetwork;
- conn_type=Ipv4;addr=174.127.232.53;act_addr_fam=InterNetwork;
x-ms-keyvault-region:
- westus
- westus2
x-ms-keyvault-service-version:
- 1.1.10.0
- 1.2.164.2
x-powered-by:
- ASP.NET
status:
Expand All @@ -116,7 +112,7 @@ interactions:
Connection:
- keep-alive
User-Agent:
- azsdk-python-keyvault-certificates/4.2.0b2 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
- azsdk-python-keyvault-certificates/4.2.2 Python/3.5.3 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://vaultname.vault.azure.net/certificates/contacts?api-version=7.1
response:
Expand All @@ -127,27 +123,25 @@ interactions:
cache-control:
- no-cache
content-length:
- '232'
- '218'
content-type:
- application/json; charset=utf-8
date:
- Wed, 29 Jul 2020 17:51:52 GMT
- Wed, 17 Feb 2021 01:33:34 GMT
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000;includeSubDomains
x-aspnet-version:
- 4.0.30319
x-content-type-options:
- nosniff
x-ms-keyvault-network-info:
- conn_type=Ipv4;addr=73.135.72.237;act_addr_fam=InterNetwork;
- conn_type=Ipv4;addr=174.127.232.53;act_addr_fam=InterNetwork;
x-ms-keyvault-region:
- westus
- westus2
x-ms-keyvault-service-version:
- 1.1.10.0
- 1.2.164.2
x-powered-by:
- ASP.NET
status:
Expand All @@ -165,7 +159,7 @@ interactions:
Content-Length:
- '0'
User-Agent:
- azsdk-python-keyvault-certificates/4.2.0b2 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
- azsdk-python-keyvault-certificates/4.2.2 Python/3.5.3 (Windows-10-10.0.19041-SP0)
method: DELETE
uri: https://vaultname.vault.azure.net/certificates/contacts?api-version=7.1
response:
Expand All @@ -176,27 +170,25 @@ interactions:
cache-control:
- no-cache
content-length:
- '232'
- '218'
content-type:
- application/json; charset=utf-8
date:
- Wed, 29 Jul 2020 17:51:52 GMT
- Wed, 17 Feb 2021 01:33:34 GMT
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000;includeSubDomains
x-aspnet-version:
- 4.0.30319
x-content-type-options:
- nosniff
x-ms-keyvault-network-info:
- conn_type=Ipv4;addr=73.135.72.237;act_addr_fam=InterNetwork;
- conn_type=Ipv4;addr=174.127.232.53;act_addr_fam=InterNetwork;
x-ms-keyvault-region:
- westus
- westus2
x-ms-keyvault-service-version:
- 1.1.10.0
- 1.2.164.2
x-powered-by:
- ASP.NET
status:
Expand All @@ -212,7 +204,7 @@ interactions:
Connection:
- keep-alive
User-Agent:
- azsdk-python-keyvault-certificates/4.2.0b2 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
- azsdk-python-keyvault-certificates/4.2.2 Python/3.5.3 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://vaultname.vault.azure.net/certificates/contacts?api-version=7.1
response:
Expand All @@ -226,23 +218,21 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Wed, 29 Jul 2020 17:51:52 GMT
- Wed, 17 Feb 2021 01:33:34 GMT
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000;includeSubDomains
x-aspnet-version:
- 4.0.30319
x-content-type-options:
- nosniff
x-ms-keyvault-network-info:
- conn_type=Ipv4;addr=73.135.72.237;act_addr_fam=InterNetwork;
- conn_type=Ipv4;addr=174.127.232.53;act_addr_fam=InterNetwork;
x-ms-keyvault-region:
- westus
- westus2
x-ms-keyvault-service-version:
- 1.1.10.0
- 1.2.164.2
x-powered-by:
- ASP.NET
status:
Expand Down
Loading

0 comments on commit 80c3b8e

Please sign in to comment.