-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Key Vault] Target multiple API versions with tests (certificates) (#…
- Loading branch information
Showing
167 changed files
with
96,915 additions
and
19,727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
sdk/keyvault/azure-keyvault-certificates/tests/_test_case.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# ------------------------------------ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
# ------------------------------------ | ||
from azure.keyvault.certificates._shared import HttpChallengeCache | ||
from azure.keyvault.certificates._shared.client_base import DEFAULT_VERSION | ||
from devtools_testutils import AzureTestCase | ||
from parameterized import parameterized | ||
import pytest | ||
|
||
|
||
def suffixed_test_name(testcase_func, param_num, param): | ||
return "{}_{}".format(testcase_func.__name__, parameterized.to_safe_name(param.kwargs.get("api_version"))) | ||
|
||
|
||
class CertificatesTestCase(AzureTestCase): | ||
def tearDown(self): | ||
HttpChallengeCache.clear() | ||
assert len(HttpChallengeCache._cache) == 0 | ||
super(CertificatesTestCase, self).tearDown() | ||
|
||
def create_client(self, vault_uri, **kwargs): | ||
if kwargs.pop("is_async", False): | ||
from azure.keyvault.certificates.aio import CertificateClient | ||
credential = self.get_credential(CertificateClient, is_async=True) | ||
else: | ||
from azure.keyvault.certificates import CertificateClient | ||
credential = self.get_credential(CertificateClient) | ||
return self.create_client_from_credential( | ||
CertificateClient, credential=credential, vault_url=vault_uri, **kwargs | ||
) | ||
|
||
def _skip_if_not_configured(self, api_version, **kwargs): | ||
if self.is_live and api_version != DEFAULT_VERSION: | ||
pytest.skip("This test only uses the default API version for live tests") |
108 changes: 54 additions & 54 deletions
108
...yvault-certificates/tests/recordings/test_certificates_client.test_2016_10_01_models.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
1,104 changes: 1,104 additions & 0 deletions
1,104
...ngs/test_certificates_client.test_async_request_cancellation_and_deletion_2016_10_01.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
281 changes: 163 additions & 118 deletions
281
...nc_request_cancellation_and_deletion.yaml → ...equest_cancellation_and_deletion_7_0.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
790 changes: 790 additions & 0 deletions
790
...recordings/test_certificates_client.test_async_request_cancellation_and_deletion_7_1.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
907 changes: 0 additions & 907 deletions
907
...-keyvault-certificates/tests/recordings/test_certificates_client.test_backup_restore.yaml
This file was deleted.
Oops, something went wrong.
952 changes: 952 additions & 0 deletions
952
...vault-certificates/tests/recordings/test_certificates_client.test_backup_restore_7_0.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
1,190 changes: 1,190 additions & 0 deletions
1,190
...vault-certificates/tests/recordings/test_certificates_client.test_backup_restore_7_1.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
240 changes: 240 additions & 0 deletions
240
...certificates/tests/recordings/test_certificates_client.test_crud_contacts_2016_10_01.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,240 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '0' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-keyvault-certificates/4.3.0b1 Python/3.5.3 (Windows-10-10.0.19041-SP0) | ||
method: PUT | ||
uri: https://vaultname.vault.azure.net/certificates/contacts?api-version=2016-10-01 | ||
response: | ||
body: | ||
string: '{"error":{"code":"Unauthorized","message":"Request is missing a Bearer | ||
or PoP token."}}' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '87' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Mon, 22 Mar 2021 21:27:04 GMT | ||
expires: | ||
- '-1' | ||
pragma: | ||
- no-cache | ||
strict-transport-security: | ||
- max-age=31536000;includeSubDomains | ||
www-authenticate: | ||
- Bearer authorization="https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47", | ||
resource="https://vault.azure.net" | ||
x-content-type-options: | ||
- nosniff | ||
x-ms-keyvault-network-info: | ||
- conn_type=Ipv4;addr=172.92.159.124;act_addr_fam=InterNetwork; | ||
x-ms-keyvault-region: | ||
- eastus2 | ||
x-ms-keyvault-service-version: | ||
- 1.2.205.0 | ||
x-powered-by: | ||
- ASP.NET | ||
status: | ||
code: 401 | ||
message: Unauthorized | ||
- request: | ||
body: '{"contacts": [{"phone": "1111111111", "name": "John Doe", "email": "[email protected]"}, | ||
{"phone": "2222222222", "name": "John Doe2", "email": "[email protected]"}]}' | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '166' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-keyvault-certificates/4.3.0b1 Python/3.5.3 (Windows-10-10.0.19041-SP0) | ||
method: PUT | ||
uri: https://vaultname.vault.azure.net/certificates/contacts?api-version=2016-10-01 | ||
response: | ||
body: | ||
string: '{"id":"https://vaultname.vault.azure.net/certificates/contacts","contacts":[{"email":"[email protected]","name":"John | ||
Doe","phone":"1111111111"},{"email":"[email protected]","name":"John Doe2","phone":"2222222222"}]}' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '220' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Mon, 22 Mar 2021 21:27:04 GMT | ||
expires: | ||
- '-1' | ||
pragma: | ||
- no-cache | ||
strict-transport-security: | ||
- max-age=31536000;includeSubDomains | ||
x-content-type-options: | ||
- nosniff | ||
x-ms-keyvault-network-info: | ||
- conn_type=Ipv4;addr=172.92.159.124;act_addr_fam=InterNetwork; | ||
x-ms-keyvault-region: | ||
- eastus2 | ||
x-ms-keyvault-service-version: | ||
- 1.2.205.0 | ||
x-powered-by: | ||
- ASP.NET | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-keyvault-certificates/4.3.0b1 Python/3.5.3 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://vaultname.vault.azure.net/certificates/contacts?api-version=2016-10-01 | ||
response: | ||
body: | ||
string: '{"id":"https://vaultname.vault.azure.net/certificates/contacts","contacts":[{"email":"[email protected]","name":"John | ||
Doe","phone":"1111111111"},{"email":"[email protected]","name":"John Doe2","phone":"2222222222"}]}' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '220' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Mon, 22 Mar 2021 21:27:04 GMT | ||
expires: | ||
- '-1' | ||
pragma: | ||
- no-cache | ||
strict-transport-security: | ||
- max-age=31536000;includeSubDomains | ||
x-content-type-options: | ||
- nosniff | ||
x-ms-keyvault-network-info: | ||
- conn_type=Ipv4;addr=172.92.159.124;act_addr_fam=InterNetwork; | ||
x-ms-keyvault-region: | ||
- eastus2 | ||
x-ms-keyvault-service-version: | ||
- 1.2.205.0 | ||
x-powered-by: | ||
- ASP.NET | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '0' | ||
User-Agent: | ||
- azsdk-python-keyvault-certificates/4.3.0b1 Python/3.5.3 (Windows-10-10.0.19041-SP0) | ||
method: DELETE | ||
uri: https://vaultname.vault.azure.net/certificates/contacts?api-version=2016-10-01 | ||
response: | ||
body: | ||
string: '{"id":"https://vaultname.vault.azure.net/certificates/contacts","contacts":[{"email":"[email protected]","name":"John | ||
Doe","phone":"1111111111"},{"email":"[email protected]","name":"John Doe2","phone":"2222222222"}]}' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '220' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Mon, 22 Mar 2021 21:27:05 GMT | ||
expires: | ||
- '-1' | ||
pragma: | ||
- no-cache | ||
strict-transport-security: | ||
- max-age=31536000;includeSubDomains | ||
x-content-type-options: | ||
- nosniff | ||
x-ms-keyvault-network-info: | ||
- conn_type=Ipv4;addr=172.92.159.124;act_addr_fam=InterNetwork; | ||
x-ms-keyvault-region: | ||
- eastus2 | ||
x-ms-keyvault-service-version: | ||
- 1.2.205.0 | ||
x-powered-by: | ||
- ASP.NET | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-keyvault-certificates/4.3.0b1 Python/3.5.3 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://vaultname.vault.azure.net/certificates/contacts?api-version=2016-10-01 | ||
response: | ||
body: | ||
string: '{"error":{"code":"ContactsNotFound","message":"Contacts not found"}}' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '68' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Mon, 22 Mar 2021 21:27:05 GMT | ||
expires: | ||
- '-1' | ||
pragma: | ||
- no-cache | ||
strict-transport-security: | ||
- max-age=31536000;includeSubDomains | ||
x-content-type-options: | ||
- nosniff | ||
x-ms-keyvault-network-info: | ||
- conn_type=Ipv4;addr=172.92.159.124;act_addr_fam=InterNetwork; | ||
x-ms-keyvault-region: | ||
- eastus2 | ||
x-ms-keyvault-service-version: | ||
- 1.2.205.0 | ||
x-powered-by: | ||
- ASP.NET | ||
status: | ||
code: 404 | ||
message: Not Found | ||
version: 1 |
Oops, something went wrong.