diff --git a/sdk/scheduler/azure-mgmt-scheduler/dev_requirements.txt b/sdk/scheduler/azure-mgmt-scheduler/dev_requirements.txt index 1a1c8d8fc379..00bff4da2800 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/dev_requirements.txt +++ b/sdk/scheduler/azure-mgmt-scheduler/dev_requirements.txt @@ -1,2 +1,3 @@ -e ../../../tools/azure-sdk-tools --e ../../../tools/azure-devtools \ No newline at end of file +-e ../../../tools/azure-devtools +../../identity/azure-identity \ No newline at end of file diff --git a/sdk/scheduler/azure-mgmt-scheduler/tests/conftest.py b/sdk/scheduler/azure-mgmt-scheduler/tests/conftest.py new file mode 100644 index 000000000000..de673c627a44 --- /dev/null +++ b/sdk/scheduler/azure-mgmt-scheduler/tests/conftest.py @@ -0,0 +1,47 @@ +# -------------------------------------------------------------------------- +# +# 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 + +# 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("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") \ No newline at end of file diff --git a/sdk/scheduler/azure-mgmt-scheduler/tests/recordings/test_mgmt_scheduler.pyTestMgmtSchedulertest_scheduler.json b/sdk/scheduler/azure-mgmt-scheduler/tests/recordings/test_mgmt_scheduler.pyTestMgmtSchedulertest_scheduler.json new file mode 100644 index 000000000000..f906621773b9 --- /dev/null +++ b/sdk/scheduler/azure-mgmt-scheduler/tests/recordings/test_mgmt_scheduler.pyTestMgmtSchedulertest_scheduler.json @@ -0,0 +1,321 @@ +{ + "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 05:33:48 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AimtGYQKPspOkzEXfkt3Piw; expires=Thu, 03-Feb-2022 05:33:49 GMT; path=/; secure; HttpOnly; SameSite=None", + "esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr3uRYAWNQ8a4Rk2bL5bfdTJEcX9fNsA6y23YO95EdpE41FqstWC7cSy4aavPX9idZxkwwkKjf31WTgdA74po_L4ZCaiYKca2q_iLrS-pDxVDGRa5bMOxbKEt7i23Z7zoi8QJfGo2yLyT5Gtt4ZihUCqpwtPbL0yxUgGAfpDJiB8sgAA; 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 - WUS2 ProdSlices", + "x-ms-request-id": "903178ec-7beb-46b8-8d2e-755dad6b0200" + }, + "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=AimtGYQKPspOkzEXfkt3Piw; 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 05:33:48 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AimtGYQKPspOkzEXfkt3Piw; expires=Thu, 03-Feb-2022 05:33:49 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 - SEASLR1 ProdSlices", + "x-ms-request-id": "ab800d36-9487-492e-b40d-f24b5aad7b00" + }, + "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": "f486646f-a102-40ef-bdb9-6697925d91b5", + "Connection": "keep-alive", + "Content-Length": "289", + "Content-Type": "application/x-www-form-urlencoded", + "Cookie": "fpc=AimtGYQKPspOkzEXfkt3Piw; 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": "f486646f-a102-40ef-bdb9-6697925d91b5", + "Content-Length": "1391", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 04 Jan 2022 05:33:48 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AimtGYQKPspOkzEXfkt3PiyZHqKEAQAAADzTZdkOAAAA; expires=Thu, 03-Feb-2022 05:33:49 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 - SCUS ProdSlices", + "x-ms-request-id": "26469378-23c1-4d1f-963b-8bb2507dae02" + }, + "ResponseBody": { + "token_type": "Bearer", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1yNS1BVWliZkJpaTdOZDFqQmViYXhib1hXMCIsImtpZCI6Ik1yNS1BVWliZkJpaTdOZDFqQmViYXhib1hXMCJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuYXp1cmUuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNTQ4MjZiMjItMzhkNi00ZmIyLWJhZDktYjdiOTNhM2U5YzVhLyIsImlhdCI6MTY0MTI3NDEyOSwibmJmIjoxNjQxMjc0MTI5LCJleHAiOjE2NDEyNzgwMjksImFpbyI6IkUyWmdZSWlRYnI5Z2NkSHBQT2VYR3ZGNnBhcTNBQT09IiwiYXBwaWQiOiJhMmRmNTRkNS1hYjAzLTQ3MjUtOWI4MC05YTAwYjNiMTk2N2YiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC81NDgyNmIyMi0zOGQ2LTRmYjItYmFkOS1iN2I5M2EzZTljNWEvIiwiaWR0eXAiOiJhcHAiLCJvaWQiOiI4ODdjNDJiMS03OTQ2LTRjMjItYmFhNi0xNTA0M2U0YjEzMjMiLCJyaCI6IjAuQVRjQUltdUNWTlk0c2stNjJiZTVPajZjV3RWVTM2SURxeVZIbTRDYUFMT3hsbjgzQUFBLiIsInN1YiI6Ijg4N2M0MmIxLTc5NDYtNGMyMi1iYWE2LTE1MDQzZTRiMTMyMyIsInRpZCI6IjU0ODI2YjIyLTM4ZDYtNGZiMi1iYWQ5LWI3YjkzYTNlOWM1YSIsInV0aSI6ImVKTkdKc0VqSDAyV080dXlVSDJ1QWciLCJ2ZXIiOiIxLjAiLCJ4bXNfY2MiOlsiQ1AxIl0sInhtc190Y2R0IjoxNDEyMjA2ODQwfQ.JVfs-mrVSIz9vuelSx3JJ1Xk4Yia8A3QTE3lhVr7okXIqo1lKEP4DeZOslwKTxfQkl6dvZxtrAGp1zMrGp2SKRTr3uhwzHPdgI0SoEeZ25zqKD4d1PMP-ggKLERlEZMqFQrXPw5STFXJx20rlruxA3NfQX2_X4fCd0-tTEeMTx6susLLikzkRsCRdN1hDRv7JaYgOaYHkVe-0q_R6dhARd9yWS-HFVVK1AyVYHGk-z5yF4Srlk66uQC4qGGyOmFjvaNhgQFSER_KwkaGLEdZ-2IOznWd6FBTCaAnvvufuRt-r95FU2L-iPq7_ApFeeCtfnnXgMs_GfEtEQM6KW4_mA" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/81542896/providers/Microsoft.Scheduler/jobCollections/myjobcollection?api-version=2016-03-01", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Accept-Encoding": "gzip, deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Content-Length": "63", + "Content-Type": "application/json", + "User-Agent": "azsdk-python-mgmt-scheduler/7.0.0b1 Python/3.8.8 (Windows-10-10.0.19041-SP0)", + "x-ms-client-request-id": "e43ecfbb-6d1f-11ec-b11b-70b5e82527ff" + }, + "RequestBody": "{\u0022location\u0022: \u0022westus\u0022, \u0022properties\u0022: {\u0022sku\u0022: {\u0022name\u0022: \u0022Free\u0022}}}", + "StatusCode": 201, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "290", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 04 Jan 2022 05:34:00 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Microsoft-IIS/8.5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-AspNet-Version": "4.0.30319", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "63d17273-2c93-45b6-be02-db0b0ab39daf", + "x-ms-ratelimit-burst-remaining-scheduler-writes": "59", + "x-ms-ratelimit-remaining-subscription-resource-requests": "299", + "x-ms-request-id": "866d6e2c-3f37-45d6-a355-5efe42c1f43f", + "x-ms-routing-request-id": "SOUTHEASTASIA:20220104T053400Z:63d17273-2c93-45b6-be02-db0b0ab39daf", + "X-Powered-By": "ASP.NET" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/81542896/providers/Microsoft.Scheduler/jobCollections/myjobcollection", + "type": "Microsoft.Scheduler/jobCollections", + "name": "myjobcollection", + "location": "West US", + "properties": { + "sku": { + "name": "Free" + }, + "state": "Enabled" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/81542896/providers/Microsoft.Scheduler/jobCollections/myjobcollection?api-version=2016-03-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json, text/json", + "Accept-Encoding": "gzip, deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-scheduler/7.0.0b1 Python/3.8.8 (Windows-10-10.0.19041-SP0)", + "x-ms-client-request-id": "eb75a150-6d1f-11ec-814c-70b5e82527ff" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 04 Jan 2022 05:34:00 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Microsoft-IIS/8.5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-AspNet-Version": "4.0.30319", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "db906721-b16c-402f-a03f-726de8becbe9", + "x-ms-ratelimit-burst-remaining-scheduler-reads": "249", + "x-ms-ratelimit-remaining-subscription-reads": "11999", + "x-ms-request-id": "98905be5-fdfa-44cb-b024-57111945df59", + "x-ms-routing-request-id": "SOUTHEASTASIA:20220104T053400Z:db906721-b16c-402f-a03f-726de8becbe9", + "X-Powered-By": "ASP.NET" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/81542896/providers/Microsoft.Scheduler/jobCollections/myjobcollection", + "type": "Microsoft.Scheduler/jobCollections", + "name": "myjobcollection", + "location": "West US", + "properties": { + "sku": { + "name": "Free" + }, + "state": "Enabled" + } + } + } + ], + "Variables": {} +} diff --git a/sdk/scheduler/azure-mgmt-scheduler/tests/recordings/test_mgmt_scheduler.test_scheduler.yaml b/sdk/scheduler/azure-mgmt-scheduler/tests/recordings/test_mgmt_scheduler.test_scheduler.yaml deleted file mode 100644 index cc360a49ab6a..000000000000 --- a/sdk/scheduler/azure-mgmt-scheduler/tests/recordings/test_mgmt_scheduler.test_scheduler.yaml +++ /dev/null @@ -1,102 +0,0 @@ -interactions: -- request: - body: '{"location": "westus", "properties": {"sku": {"name": "Free"}}}' - headers: - Accept: - - application/json, text/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '63' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-scheduler/7.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_scheduler_test_schedulerf5fc0dff/providers/Microsoft.Scheduler/jobCollections/myjobcollection?api-version=2016-03-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_scheduler_test_schedulerf5fc0dff/providers/Microsoft.Scheduler/jobCollections/myjobcollection","type":"Microsoft.Scheduler/jobCollections","name":"myjobcollection","location":"West - US","properties":{"sku":{"name":"Free"},"state":"Enabled"}}' - headers: - cache-control: - - no-cache - content-length: - - '324' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 22 Oct 2020 06:53:37 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-IIS/8.5 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-aspnet-version: - - 4.0.30319 - x-content-type-options: - - nosniff - x-ms-ratelimit-burst-remaining-scheduler-writes: - - '59' - x-ms-ratelimit-remaining-subscription-resource-requests: - - '299' - x-powered-by: - - ASP.NET - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - application/json, text/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-scheduler/7.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_scheduler_test_schedulerf5fc0dff/providers/Microsoft.Scheduler/jobCollections/myjobcollection?api-version=2016-03-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_scheduler_test_schedulerf5fc0dff/providers/Microsoft.Scheduler/jobCollections/myjobcollection","type":"Microsoft.Scheduler/jobCollections","name":"myjobcollection","location":"West - US","properties":{"sku":{"name":"Free"},"state":"Enabled"}}' - headers: - cache-control: - - no-cache - content-length: - - '324' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 22 Oct 2020 06:53:37 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-IIS/8.5 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-aspnet-version: - - 4.0.30319 - x-content-type-options: - - nosniff - x-ms-ratelimit-burst-remaining-scheduler-reads: - - '249' - x-powered-by: - - ASP.NET - status: - code: 200 - message: OK -version: 1 diff --git a/sdk/scheduler/azure-mgmt-scheduler/tests/test_mgmt_scheduler.py b/sdk/scheduler/azure-mgmt-scheduler/tests/test_mgmt_scheduler.py index b0de71593176..9719d131bc76 100644 --- a/sdk/scheduler/azure-mgmt-scheduler/tests/test_mgmt_scheduler.py +++ b/sdk/scheduler/azure-mgmt-scheduler/tests/test_mgmt_scheduler.py @@ -12,18 +12,18 @@ import azure.mgmt.scheduler.patch from devtools_testutils import ( - AzureMgmtTestCase, ResourceGroupPreparer, + AzureMgmtRecordedTestCase, ResourceGroupPreparer, recorded_by_proxy ) -class MgmtSchedulerTest(AzureMgmtTestCase): +class TestMgmtScheduler(AzureMgmtRecordedTestCase): - def setUp(self): - super(MgmtSchedulerTest, self).setUp() + def setup_method(self, method): self.scheduler_client = self.create_mgmt_client( azure.mgmt.scheduler.SchedulerManagementClient ) @ResourceGroupPreparer() + @recorded_by_proxy def test_scheduler(self, resource_group, location): jobcollection_name = "myjobcollection" self.scheduler_client.job_collections.create_or_update( @@ -41,10 +41,11 @@ def test_scheduler(self, resource_group, location): resource_group.name, jobcollection_name, ) - self.assertEqual(result.name, jobcollection_name) + assert result.name == jobcollection_name @unittest.skip("(BadRequest) Malformed Job Object") @ResourceGroupPreparer() + @recorded_by_proxy def test_scheduler_job_custom_time(self, resource_group, location): jobcollection_name = "myjobcollection" self.scheduler_client.job_collections.create_or_update( @@ -80,7 +81,7 @@ def test_scheduler_job_custom_time(self, resource_group, location): "state": "Disabled" } ) - self.assertEqual(job_properties.action.retry_policy.retry_interval, timedelta(days=1)) + assert job_properties.action.retry_policy.retry_interval == timedelta(days=1) job_name = "myjob" self.scheduler_client.jobs.create_or_update( @@ -95,7 +96,7 @@ def test_scheduler_job_custom_time(self, resource_group, location): jobcollection_name, job_name ) - self.assertEqual(job.properties.action.retry_policy.retry_interval, timedelta(days=1)) + assert job.properties.action.retry_policy.retry_interval == timedelta(days=1) #------------------------------------------------------------------------------ if __name__ == '__main__': diff --git a/sdk/scheduler/ci.yml b/sdk/scheduler/ci.yml index 8796c40ab3ff..27395eb7dcb5 100644 --- a/sdk/scheduler/ci.yml +++ b/sdk/scheduler/ci.yml @@ -27,6 +27,7 @@ extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: scheduler + TestProxy: true Artifacts: - name: azure-mgmt-scheduler safeName: azuremgmtscheduler