Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f1aeb2f
Merge pull request #1 from Azure/master
BigCat20196 Jun 7, 2021
89cb1ee
Merge pull request #2 from Azure/main
BigCat20196 Jun 21, 2021
ceb1300
Merge pull request #3 from Azure/main
BigCat20196 Jul 1, 2021
23da66e
Merge pull request #4 from Azure/main
BigCat20196 Jul 7, 2021
25145b5
Merge pull request #5 from Azure/main
BigCat20196 Jul 9, 2021
b24885e
Merge pull request #6 from Azure/main
BigCat20196 Jul 12, 2021
2ef256c
Merge pull request #7 from Azure/main
BigCat20196 Jul 27, 2021
10a97e5
Merge pull request #8 from Azure/main
BigCat20196 Aug 4, 2021
24f65c3
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Oct 9, 2021
3fdba01
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Oct 12, 2021
3e8eb8e
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Oct 13, 2021
92b06a6
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Oct 28, 2021
40ce8cc
Merge branch 'main' of https://github.com/BigCat20196/azure-sdk-for-p…
BigCat20196 Jun 22, 2022
675245f
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jun 22, 2022
b0b6c17
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jun 29, 2022
71a41f2
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jun 30, 2022
246c7bf
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jul 5, 2022
4d20deb
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jul 6, 2022
268bbd8
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jul 13, 2022
3e0c372
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jul 25, 2022
67ee4b1
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jul 29, 2022
fda4c3b
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Aug 1, 2022
6597edb
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Aug 1, 2022
ed90f61
migrate
BigCat20196 Aug 1, 2022
305b2d5
update test recordings
BigCat20196 Aug 2, 2022
128fab7
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Aug 3, 2022
08e3d20
update
BigCat20196 Aug 4, 2022
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
32 changes: 32 additions & 0 deletions sdk/purview/azure-purview-administration/tests/_aio_testcase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import asyncio
from unittest.mock import Mock

from azure.core.credentials import AccessToken
from devtools_testutils import AzureRecordedTestCase


class AzureRecordedAsyncTestCase(AzureRecordedTestCase):

@property
def event_loop(self):
return asyncio.get_event_loop()

def create_aio_client(self, client, **kwargs):
if self.is_live:
from azure.identity.aio import DefaultAzureCredential
credential = DefaultAzureCredential()
else:
credential = Mock(get_token=asyncio.coroutine(lambda _: AccessToken("fake-token", 0)))
return client(
credential=credential,
subscription_id=self.get_settings_value("SUBSCRIPTION_ID")
)

def to_list(self, ait):
async def lst():
result = []
async for item in ait:
result.append(item)
return result

return self.event_loop.run_until_complete(lst())
25 changes: 0 additions & 25 deletions sdk/purview/azure-purview-administration/tests/_util.py

This file was deleted.

57 changes: 57 additions & 0 deletions sdk/purview/azure-purview-administration/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# --------------------------------------------------------------------------
import os
import platform
import pytest
import sys

from dotenv import load_dotenv

from devtools_testutils import test_proxy, add_general_regex_sanitizer, add_body_key_sanitizer, add_header_regex_sanitizer

# Ignore async tests for Python < 3.5
collect_ignore_glob = []
if sys.version_info < (3, 5) or platform.python_implementation() == "PyPy":
collect_ignore_glob.append("*_async.py")

load_dotenv()

@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
subscription_id = os.environ.get("PURVIEWACCOUNT_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
tenant_id = os.environ.get("PURVIEWACCOUNT_TENANT_ID", "00000000-0000-0000-0000-000000000000")
client_id = os.environ.get("PURVIEWACCOUNT_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
client_secret = os.environ.get("PURVIEWACCOUNT_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=client_secret, value="00000000-0000-0000-0000-000000000000")
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")
add_body_key_sanitizer(json_path="$..atlasKafkaPrimaryEndpoint", value="000")
add_body_key_sanitizer(json_path="$..atlasKafkaSecondaryEndpoint", value="000")
add_body_key_sanitizer(json_path="$..systemData.createdBy", value="000")
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
{
"Entries": [
{
"RequestUri": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/v2.0/.well-known/openid-configuration",
"RequestMethod": "GET",
"RequestHeaders": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"User-Agent": "azsdk-python-identity/1.11.0b3 Python/3.8.8 (Windows-10-10.0.19041-SP0)"
},
"RequestBody": null,
"StatusCode": 200,
"ResponseHeaders": {
"Access-Control-Allow-Methods": "GET, OPTIONS",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "max-age=86400, private",
"Content-Length": "1753",
"Content-Type": "application/json; charset=utf-8",
"Date": "Thu, 04 Aug 2022 03:09:53 GMT",
"P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022",
"Set-Cookie": "[set-cookie;]",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"x-ms-ests-server": "2.1.13418.9 - WUS2 ProdSlices",
"X-XSS-Protection": "0"
},
"ResponseBody": {
"token_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/token",
"token_endpoint_auth_methods_supported": [
"client_secret_post",
"private_key_jwt",
"client_secret_basic"
],
"jwks_uri": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/discovery/v2.0/keys",
"response_modes_supported": [
"query",
"fragment",
"form_post"
],
"subject_types_supported": [
"pairwise"
],
"id_token_signing_alg_values_supported": [
"RS256"
],
"response_types_supported": [
"code",
"id_token",
"code id_token",
"id_token token"
],
"scopes_supported": [
"openid",
"profile",
"email",
"offline_access"
],
"issuer": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/v2.0",
"request_uri_parameter_supported": false,
"userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo",
"authorization_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/authorize",
"device_authorization_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/devicecode",
"http_logout_supported": true,
"frontchannel_logout_supported": true,
"end_session_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/logout",
"claims_supported": [
"sub",
"iss",
"cloud_instance_name",
"cloud_instance_host_name",
"cloud_graph_host_name",
"msgraph_host",
"aud",
"exp",
"iat",
"auth_time",
"acr",
"nonce",
"preferred_username",
"name",
"tid",
"ver",
"at_hash",
"c_hash",
"email"
],
"kerberos_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/kerberos",
"tenant_region_scope": "NA",
"cloud_instance_name": "microsoftonline.com",
"cloud_graph_host_name": "graph.windows.net",
"msgraph_host": "graph.microsoft.com",
"rbac_url": "https://pas.windows.net"
}
},
{
"RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https://login.microsoftonline.com/common/oauth2/authorize",
"RequestMethod": "GET",
"RequestHeaders": {
"Accept": "application/json",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Cookie": "cookie;",
"User-Agent": "azsdk-python-identity/1.11.0b3 Python/3.8.8 (Windows-10-10.0.19041-SP0)"
},
"RequestBody": null,
"StatusCode": 200,
"ResponseHeaders": {
"Access-Control-Allow-Methods": "GET, OPTIONS",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "max-age=86400, private",
"Content-Length": "945",
"Content-Type": "application/json; charset=utf-8",
"Date": "Thu, 04 Aug 2022 03:09:53 GMT",
"P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022",
"Set-Cookie": "[set-cookie;]",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"x-ms-ests-server": "2.1.13418.9 - KRC ProdSlices",
"X-XSS-Protection": "0"
},
"ResponseBody": {
"tenant_discovery_endpoint": "https://login.microsoftonline.com/common/.well-known/openid-configuration",
"api-version": "1.1",
"metadata": [
{
"preferred_network": "login.microsoftonline.com",
"preferred_cache": "login.windows.net",
"aliases": [
"login.microsoftonline.com",
"login.windows.net",
"login.microsoft.com",
"sts.windows.net"
]
},
{
"preferred_network": "login.partner.microsoftonline.cn",
"preferred_cache": "login.partner.microsoftonline.cn",
"aliases": [
"login.partner.microsoftonline.cn",
"login.chinacloudapi.cn"
]
},
{
"preferred_network": "login.microsoftonline.de",
"preferred_cache": "login.microsoftonline.de",
"aliases": [
"login.microsoftonline.de"
]
},
{
"preferred_network": "login.microsoftonline.us",
"preferred_cache": "login.microsoftonline.us",
"aliases": [
"login.microsoftonline.us",
"login.usgovcloudapi.net"
]
},
{
"preferred_network": "login-us.microsoftonline.com",
"preferred_cache": "login-us.microsoftonline.com",
"aliases": [
"login-us.microsoftonline.com"
]
}
]
}
},
{
"RequestUri": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/token",
"RequestMethod": "POST",
"RequestHeaders": {
"Accept": "application/json",
"Accept-Encoding": "gzip, deflate",
"client-request-id": "408c37d7-b5f9-4097-a953-298c1f2cca7c",
"Connection": "keep-alive",
"Content-Length": "285",
"Content-Type": "application/x-www-form-urlencoded",
"Cookie": "cookie;",
"User-Agent": "azsdk-python-identity/1.11.0b3 Python/3.8.8 (Windows-10-10.0.19041-SP0)",
"x-client-cpu": "x64",
"x-client-current-telemetry": "4|730,0|",
"x-client-last-telemetry": "4|0|||",
"x-client-os": "win32",
"x-client-sku": "MSAL.Python",
"x-client-ver": "1.16.0",
"x-ms-lib-capability": "retry-after, h429"
},
"RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fpurview.azure.net%2F.default",
"StatusCode": 200,
"ResponseHeaders": {
"Cache-Control": "no-store, no-cache",
"client-request-id": "408c37d7-b5f9-4097-a953-298c1f2cca7c",
"Content-Length": "93",
"Content-Type": "application/json; charset=utf-8",
"Date": "Thu, 04 Aug 2022 03:09:54 GMT",
"Expires": "-1",
"P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022",
"Pragma": "no-cache",
"Set-Cookie": "[set-cookie;]",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"x-ms-clitelem": "1,0,0,,",
"x-ms-ests-server": "2.1.13418.9 - SCUS ProdSlices",
"X-XSS-Protection": "0"
},
"ResponseBody": {
"token_type": "Bearer",
"expires_in": 3599,
"ext_expires_in": 3599,
"access_token": "access_token"
}
},
{
"RequestUri": "https://fake_account.account.purview.azure.com/listkeys?api-version=2019-11-01-preview",
"RequestMethod": "POST",
"RequestHeaders": {
"Accept": "application/json",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Content-Length": "0",
"User-Agent": "azsdk-python-purview-administration/1.0.0b1 Python/3.8.8 (Windows-10-10.0.19041-SP0)"
},
"RequestBody": null,
"StatusCode": 200,
"ResponseHeaders": {
"api-supported-versions": "2019-11-01-preview",
"Content-Length": "71",
"Content-Type": "application/json; charset=utf-8",
"Date": "Thu, 04 Aug 2022 03:09:55 GMT",
"Server": "Kestrel",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"x-ms-correlation-request-id": "27d38066-70c8-4207-9aad-288a17f2ebd5"
},
"ResponseBody": {
"atlasKafkaPrimaryEndpoint": "000",
"atlasKafkaSecondaryEndpoint": "000"
}
}
],
"Variables": {}
}
Loading