forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate batch to testProxy (Azure#22313)
* migrate tests * Update test and json * Update json * some testcase only run live test * Update conftest.py Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
- Loading branch information
1 parent
cf54d28
commit ac3e370
Showing
23 changed files
with
7,990 additions
and
3,331 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
-e ../../../tools/azure-sdk-tools | ||
azure-mgmt-keyvault<9.0.0 | ||
azure-mgmt-network<19.0.0 | ||
-e ../../../tools/azure-devtools | ||
-e ../../../tools/azure-devtools | ||
../../identity/azure-identity |
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,43 @@ | ||
# -------------------------------------------------------------------------- | ||
# | ||
# 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 | ||
|
||
|
||
load_dotenv() | ||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def add_sanitizers(test_proxy): | ||
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") | ||
tenant_id = os.environ.get("AZURE_TENANT_ID", "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") |
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
1,473 changes: 1,473 additions & 0 deletions
1,473
...e-mgmt-batch/tests/recordings/test_mgmt_batch.pyTestMgmtBatchtest_mgmt_batch_account.json
Large diffs are not rendered by default.
Oops, something went wrong.
1,555 changes: 1,555 additions & 0 deletions
1,555
...tch/tests/recordings/test_mgmt_batch.pyTestMgmtBatchtest_mgmt_batch_account_advanced.json
Large diffs are not rendered by default.
Oops, something went wrong.
341 changes: 341 additions & 0 deletions
341
...t-batch/tests/recordings/test_mgmt_batch.pyTestMgmtBatchtest_mgmt_batch_account_name.json
Large diffs are not rendered by default.
Oops, something went wrong.
1,003 changes: 1,003 additions & 0 deletions
1,003
...t-batch/tests/recordings/test_mgmt_batch.pyTestMgmtBatchtest_mgmt_batch_applications.json
Large diffs are not rendered by default.
Oops, something went wrong.
273 changes: 273 additions & 0 deletions
273
...t-batch/tests/recordings/test_mgmt_batch.pyTestMgmtBatchtest_mgmt_batch_byos_account.json
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,273 @@ | ||
{ | ||
"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.7.2 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": "Tue, 04 Jan 2022 06:58:56 GMT", | ||
"P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", | ||
"Set-Cookie": [ | ||
"fpc=AsNLgXfXYbJOtMgxrT2mcrg; expires=Thu, 03-Feb-2022 06:58:57 GMT; path=/; secure; HttpOnly; SameSite=None", | ||
"esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrkTa6knR62TSGK5-h7HMB5QyqmAygsBiJbmxb8CNcqRa0q3XSlhwgFFa3BUDS9nWXuyXCd03q-zdDHV0O3exs6dyYcb6t3GHxnMTdsT9qyqd2YpkcDB3npLvyfdcMGJJgVsU6lnbFOQTdawqbw76bktYi4JYk_byYkf8WcfMSpNcgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None", | ||
"x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly", | ||
"stsservicecookie=estsfd; path=/; secure; samesite=none; httponly" | ||
], | ||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains", | ||
"X-Content-Type-Options": "nosniff", | ||
"x-ms-ests-server": "2.1.12261.17 - EUS ProdSlices", | ||
"x-ms-request-id": "34f472f9-92a2-495c-9879-0775b3b02c02" | ||
}, | ||
"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": "fpc=AsNLgXfXYbJOtMgxrT2mcrg; stsservicecookie=estsfd; x-ms-gateway-slice=estsfd", | ||
"User-Agent": "azsdk-python-identity/1.7.2 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": "Tue, 04 Jan 2022 06:58:56 GMT", | ||
"P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", | ||
"Set-Cookie": [ | ||
"fpc=AsNLgXfXYbJOtMgxrT2mcrg; expires=Thu, 03-Feb-2022 06:58:57 GMT; path=/; secure; HttpOnly; SameSite=None", | ||
"x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly", | ||
"stsservicecookie=estsfd; path=/; secure; samesite=none; httponly" | ||
], | ||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains", | ||
"X-Content-Type-Options": "nosniff", | ||
"x-ms-ests-server": "2.1.12261.17 - SEASLR2 ProdSlices", | ||
"x-ms-request-id": "b408faf0-040e-4696-86b6-6722b7e76f00" | ||
}, | ||
"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": "5f35b6df-2037-4aa7-97fb-d3c27adaee19", | ||
"Connection": "keep-alive", | ||
"Content-Length": "289", | ||
"Content-Type": "application/x-www-form-urlencoded", | ||
"Cookie": "fpc=AsNLgXfXYbJOtMgxrT2mcrg; stsservicecookie=estsfd; x-ms-gateway-slice=estsfd", | ||
"User-Agent": "azsdk-python-identity/1.7.2 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=a2df54d5-ab03-4725-9b80-9a00b3b1967f\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=0vj7Q~IsFayrD0V_8oyOfygU-GE3ELOabq95a\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%2Fmanagement.azure.com%2F.default", | ||
"StatusCode": 200, | ||
"ResponseHeaders": { | ||
"Cache-Control": "no-store, no-cache", | ||
"client-request-id": "5f35b6df-2037-4aa7-97fb-d3c27adaee19", | ||
"Content-Length": "1391", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Date": "Tue, 04 Jan 2022 06:58:57 GMT", | ||
"Expires": "-1", | ||
"P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", | ||
"Pragma": "no-cache", | ||
"Set-Cookie": [ | ||
"fpc=AsNLgXfXYbJOtMgxrT2mcriZHqKEAQAAADHnZdkOAAAA; expires=Thu, 03-Feb-2022 06:58:57 GMT; path=/; secure; HttpOnly; SameSite=None", | ||
"x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly", | ||
"stsservicecookie=estsfd; path=/; secure; samesite=none; httponly" | ||
], | ||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains", | ||
"X-Content-Type-Options": "nosniff", | ||
"x-ms-clitelem": "1,0,0,,", | ||
"x-ms-ests-server": "2.1.12261.17 - EUS ProdSlices", | ||
"x-ms-request-id": "34f472f9-92a2-495c-9879-0775c1b02c02" | ||
}, | ||
"ResponseBody": { | ||
"token_type": "Bearer", | ||
"expires_in": 3599, | ||
"ext_expires_in": 3599, | ||
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1yNS1BVWliZkJpaTdOZDFqQmViYXhib1hXMCIsImtpZCI6Ik1yNS1BVWliZkJpaTdOZDFqQmViYXhib1hXMCJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuYXp1cmUuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNTQ4MjZiMjItMzhkNi00ZmIyLWJhZDktYjdiOTNhM2U5YzVhLyIsImlhdCI6MTY0MTI3OTIzNywibmJmIjoxNjQxMjc5MjM3LCJleHAiOjE2NDEyODMxMzcsImFpbyI6IkUyWmdZR0E4UGZ0OS9aemQrMmVMUkhvcEgxNXdEQUE9IiwiYXBwaWQiOiJhMmRmNTRkNS1hYjAzLTQ3MjUtOWI4MC05YTAwYjNiMTk2N2YiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC81NDgyNmIyMi0zOGQ2LTRmYjItYmFkOS1iN2I5M2EzZTljNWEvIiwiaWR0eXAiOiJhcHAiLCJvaWQiOiI4ODdjNDJiMS03OTQ2LTRjMjItYmFhNi0xNTA0M2U0YjEzMjMiLCJyaCI6IjAuQVRjQUltdUNWTlk0c2stNjJiZTVPajZjV3RWVTM2SURxeVZIbTRDYUFMT3hsbjgzQUFBLiIsInN1YiI6Ijg4N2M0MmIxLTc5NDYtNGMyMi1iYWE2LTE1MDQzZTRiMTMyMyIsInRpZCI6IjU0ODI2YjIyLTM4ZDYtNGZiMi1iYWQ5LWI3YjkzYTNlOWM1YSIsInV0aSI6Ii1YTDBOS0tTWEVtWWVRZDF3YkFzQWciLCJ2ZXIiOiIxLjAiLCJ4bXNfY2MiOlsiQ1AxIl0sInhtc190Y2R0IjoxNDEyMjA2ODQwfQ.ukqi9rfI4FMN7IcDVxow_Xyj4ACbZ223be-P-4rHtA2SwH1AlZ1GPR41AI-Gr0yG0ShbMTb1v93M-r---ryBRsysJcq_XvM5D9LE06-eYmpa7dYA9WHW1otq22tzhv3po44V2r4DveE14Vl2GSw97pbQMABoDohjOakYiNs83UxoeK17blvgDMfJdu8LibQSdsiEksYQDOB0IKedO8nYr6xuf-h-cFSS6TyfW_Igc8zYhb1s3qCPy0FF-RgJq2B-vUCffv-L67xuthJdoMZzTRvhdyV7N7WQNlr7XcUbr31_n6oXWWzBfeb3PIVbokPrVQ8pk_D0PaUo6uwWWorRWw" | ||
} | ||
}, | ||
{ | ||
"RequestUri": "https://centraluseuap.management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/4d42761/providers/Microsoft.Batch/batchAccounts/batch4d42761?api-version=2021-06-01", | ||
"RequestMethod": "PUT", | ||
"RequestHeaders": { | ||
"Accept": "application/json", | ||
"Accept-Encoding": "gzip, deflate", | ||
"Authorization": "Sanitized", | ||
"Connection": "keep-alive", | ||
"Content-Length": "114", | ||
"Content-Type": "application/json", | ||
"User-Agent": "azsdk-python-mgmt-batch/16.0.0 Python/3.8.8 (Windows-10-10.0.19041-SP0)", | ||
"x-ms-client-request-id": "c8f040ec-6d2b-11ec-a64a-70b5e82527ff" | ||
}, | ||
"RequestBody": "{\u0022location\u0022: \u0022eastus\u0022, \u0022properties\u0022: {\u0022poolAllocationMode\u0022: \u0022UserSubscription\u0022, \u0022publicNetworkAccess\u0022: \u0022Enabled\u0022}}", | ||
"StatusCode": 400, | ||
"ResponseHeaders": { | ||
"Cache-Control": "no-cache", | ||
"Content-Length": "359", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Date": "Tue, 04 Jan 2022 06:58:59 GMT", | ||
"Expires": "-1", | ||
"Pragma": "no-cache", | ||
"Server": "Microsoft-HTTPAPI/2.0", | ||
"Strict-Transport-Security": "max-age=31536000; includeSubDomains", | ||
"X-Content-Type-Options": "nosniff", | ||
"x-ms-correlation-request-id": "a2c353f0-1bd3-41be-812e-6dbf24cc03d0", | ||
"x-ms-ratelimit-remaining-subscription-writes": "1199", | ||
"x-ms-request-id": "e8d4c4a7-1802-4d81-aa8a-836d61cf75a8", | ||
"x-ms-routing-request-id": "CENTRALUSEUAP:20220104T065900Z:a2c353f0-1bd3-41be-812e-6dbf24cc03d0" | ||
}, | ||
"ResponseBody": { | ||
"error": { | ||
"code": "InvalidRequestBody", | ||
"message": "The specified Request Body is not syntactically valid.\nRequestId:e8d4c4a7-1802-4d81-aa8a-836d61cf75a8\nTime:2022-01-04T06:59:00.6526768Z", | ||
"target": "BatchAccount", | ||
"details": [ | ||
{ | ||
"code": "Reason", | ||
"message": "keyVaultReference must be set if poolAllocationMode is specified as \u0027UserSubscription\u0027 on a PUT request" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"Variables": {} | ||
} |
Oops, something went wrong.