From 9bbad33494bd251e77178637bf47f83502115725 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Thu, 30 Apr 2020 17:19:13 +0200 Subject: [PATCH] Adding test for signalr (#11146) * generated signalr test * generated recording * Packaging update of azure-mgmt-signalr Co-authored-by: Azure SDK Bot --- sdk/signalr/azure-mgmt-signalr/README.md | 30 +- sdk/signalr/azure-mgmt-signalr/setup.py | 5 +- .../test_cli_mgmt_signalr.test_signalr.yaml | 765 ++++++++++++++++++ .../tests/test_cli_mgmt_signalr.py | 136 ++++ 4 files changed, 916 insertions(+), 20 deletions(-) create mode 100644 sdk/signalr/azure-mgmt-signalr/tests/recordings/test_cli_mgmt_signalr.test_signalr.yaml create mode 100644 sdk/signalr/azure-mgmt-signalr/tests/test_cli_mgmt_signalr.py diff --git a/sdk/signalr/azure-mgmt-signalr/README.md b/sdk/signalr/azure-mgmt-signalr/README.md index d13cd5da41bb..8dc4f14cf656 100644 --- a/sdk/signalr/azure-mgmt-signalr/README.md +++ b/sdk/signalr/azure-mgmt-signalr/README.md @@ -1,29 +1,21 @@ -## Microsoft Azure SDK for Python +# Microsoft Azure SDK for Python This is the Microsoft Azure SignalR Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/) -Azure Resource Manager (ARM) is the next generation of management APIs -that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.5, 3.6 and 3.7. +# Usage -For the older Azure Service Management (ASM) libraries, see -[azure-servicemanagement-legacy](https://pypi.python.org/pypi/azure-servicemanagement-legacy) -library. +For code examples, see [SignalR](https://docs.microsoft.com/python/api/overview/azure/) +on docs.microsoft.com. -For a more complete set of Azure libraries, see the -[azure](https://pypi.python.org/pypi/azure) bundle package. -## Usage +# Provide Feedback -For code examples, see -[SignalR](https://docs.microsoft.com/python/api/overview/azure/) on -docs.microsoft.com. - -## Provide Feedback - -If you encounter any bugs or have suggestions, please file an issue in -the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. -![image](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-signalr%2FREADME.png) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-signalr%2FREADME.png) diff --git a/sdk/signalr/azure-mgmt-signalr/setup.py b/sdk/signalr/azure-mgmt-signalr/setup.py index fef5ae53eac2..6a18873c59f4 100644 --- a/sdk/signalr/azure-mgmt-signalr/setup.py +++ b/sdk/signalr/azure-mgmt-signalr/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -67,6 +69,7 @@ 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'License :: OSI Approved :: MIT License', ], zip_safe=False, diff --git a/sdk/signalr/azure-mgmt-signalr/tests/recordings/test_cli_mgmt_signalr.test_signalr.yaml b/sdk/signalr/azure-mgmt-signalr/tests/recordings/test_cli_mgmt_signalr.test_signalr.yaml new file mode 100644 index 000000000000..267bec962841 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/tests/recordings/test_cli_mgmt_signalr.test_signalr.yaml @@ -0,0 +1,765 @@ +interactions: +- request: + body: '{"tags": {"key1": "value1"}, "sku": {"name": "Standard_S1", "tier": "Standard", + "capacity": 1}, "properties": {"features": [{"flag": "ServiceMode", "value": + "Serverless"}], "cors": {"allowedOrigins": ["https://foo.com", "https://bar.com"]}}, + "location": "eastus"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '263' + Content-Type: + - application/json; charset=utf-8 + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/signalR/myResource?api-version=2018-10-01 + response: + body: + string: '{"sku":{"name":"Standard_S1","tier":"Standard","size":"S1","capacity":1},"properties":{"provisioningState":"Creating","externalIP":null,"hostName":"myresource.service.signalr.net","publicPort":443,"serverPort":443,"version":"1.0-preview","privateEndpointConnections":[],"hostNamePrefix":"myresource","features":[{"flag":"ServiceMode","value":"Serverless","properties":{}},{"flag":"EnableConnectivityLogs","value":"False","properties":{}},{"flag":"EnableMessagingLogs","value":"False","properties":{}}],"cors":{"allowedOrigins":["https://foo.com","https://bar.com"]},"upstream":{"templates":null},"networkACLs":{"defaultAction":"Deny","publicNetwork":{"allow":["ServerConnection","ClientConnection","RESTAPI"],"deny":null},"privateEndpoints":[]}},"location":"eastus","tags":{"key1":"value1"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/SignalR/myResource","name":"myResource","type":"Microsoft.SignalRService/SignalR","kind":"SignalR"}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/99e0f7b7-a4f7-476b-9869-0f7de5b4ea87?api-version=2018-10-01 + cache-control: + - no-cache + content-length: + - '1041' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:24:40 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationResults/99e0f7b7-a4f7-476b-9869-0f7de5b4ea87/SignalR/myResource?api-version=2018-10-01 + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/99e0f7b7-a4f7-476b-9869-0f7de5b4ea87?api-version=2018-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/99e0f7b7-a4f7-476b-9869-0f7de5b4ea87","name":"99e0f7b7-a4f7-476b-9869-0f7de5b4ea87","status":"Running","startTime":"2020-04-30T14:24:39.4587136Z"}' + headers: + cache-control: + - no-cache + content-length: + - '356' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:25:11 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/99e0f7b7-a4f7-476b-9869-0f7de5b4ea87?api-version=2018-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/99e0f7b7-a4f7-476b-9869-0f7de5b4ea87","name":"99e0f7b7-a4f7-476b-9869-0f7de5b4ea87","status":"Running","startTime":"2020-04-30T14:24:39.4587136Z"}' + headers: + cache-control: + - no-cache + content-length: + - '356' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:25:42 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/99e0f7b7-a4f7-476b-9869-0f7de5b4ea87?api-version=2018-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/99e0f7b7-a4f7-476b-9869-0f7de5b4ea87","name":"99e0f7b7-a4f7-476b-9869-0f7de5b4ea87","status":"Succeeded","startTime":"2020-04-30T14:24:39.4587136Z","endTime":"2020-04-30T14:25:56.4099109Z"}' + headers: + cache-control: + - no-cache + content-length: + - '399' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:26:13 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/signalR/myResource?api-version=2018-10-01 + response: + body: + string: '{"sku":{"name":"Standard_S1","tier":"Standard","size":"S1","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"40.71.15.7","hostName":"myresource.service.signalr.net","publicPort":443,"serverPort":443,"version":"1.0","privateEndpointConnections":[],"hostNamePrefix":"myresource","features":[{"flag":"ServiceMode","value":"Serverless","properties":{}},{"flag":"EnableConnectivityLogs","value":"False","properties":{}},{"flag":"EnableMessagingLogs","value":"False","properties":{}}],"cors":{"allowedOrigins":["https://foo.com","https://bar.com"]},"upstream":{"templates":null},"networkACLs":{"defaultAction":"Deny","publicNetwork":{"allow":["ServerConnection","ClientConnection","RESTAPI"],"deny":null},"privateEndpoints":[]}},"location":"eastus","tags":{"key1":"value1"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/SignalR/myResource","name":"myResource","type":"Microsoft.SignalRService/SignalR","kind":"SignalR"}' + headers: + cache-control: + - no-cache + content-length: + - '1042' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:26:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/signalR/myResource?api-version=2018-10-01 + response: + body: + string: '{"sku":{"name":"Standard_S1","tier":"Standard","size":"S1","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"40.71.15.7","hostName":"myresource.service.signalr.net","publicPort":443,"serverPort":443,"version":"1.0","privateEndpointConnections":[],"hostNamePrefix":"myresource","features":[{"flag":"ServiceMode","value":"Serverless","properties":{}},{"flag":"EnableConnectivityLogs","value":"False","properties":{}},{"flag":"EnableMessagingLogs","value":"False","properties":{}}],"cors":{"allowedOrigins":["https://foo.com","https://bar.com"]},"upstream":{"templates":null},"networkACLs":{"defaultAction":"Deny","publicNetwork":{"allow":["ServerConnection","ClientConnection","RESTAPI"],"deny":null},"privateEndpoints":[]}},"location":"eastus","tags":{"key1":"value1"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/SignalR/myResource","name":"myResource","type":"Microsoft.SignalRService/SignalR","kind":"SignalR"}' + headers: + cache-control: + - no-cache + content-length: + - '1042' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:26:16 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/SignalR/myResource/listKeys?api-version=2018-10-01 + response: + body: + string: '{"primaryKey":"Nj4VNIHZNdwAKU32mM22ureU/yo4JamK79FQiOzvGik=","secondaryKey":"aWqFqjyYds8z+LBCeRlmHlsS8IVN8JYh1UXPpk30a04=","primaryConnectionString":"Endpoint=https://myresource.service.signalr.net;AccessKey=Nj4VNIHZNdwAKU32mM22ureU/yo4JamK79FQiOzvGik=;Version=1.0;","secondaryConnectionString":"Endpoint=https://myresource.service.signalr.net;AccessKey=aWqFqjyYds8z+LBCeRlmHlsS8IVN8JYh1UXPpk30a04=;Version=1.0;"}' + headers: + cache-control: + - no-cache + content-length: + - '413' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:26:17 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/signalR/myResource/restart?api-version=2018-10-01 + response: + body: + string: '' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/3296660b-933d-4664-bfd4-8aebcd21cbdf?api-version=2018-10-01 + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Apr 2020 14:26:18 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationResults/3296660b-933d-4664-bfd4-8aebcd21cbdf/SignalR/myResource?api-version=2018-10-01 + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/3296660b-933d-4664-bfd4-8aebcd21cbdf?api-version=2018-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/3296660b-933d-4664-bfd4-8aebcd21cbdf","name":"3296660b-933d-4664-bfd4-8aebcd21cbdf","status":"Running","startTime":"2020-04-30T14:26:19.0976905Z"}' + headers: + cache-control: + - no-cache + content-length: + - '356' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:26:49 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/3296660b-933d-4664-bfd4-8aebcd21cbdf?api-version=2018-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/3296660b-933d-4664-bfd4-8aebcd21cbdf","name":"3296660b-933d-4664-bfd4-8aebcd21cbdf","status":"Succeeded","startTime":"2020-04-30T14:26:19.0976905Z","endTime":"2020-04-30T14:26:50.9934575Z"}' + headers: + cache-control: + - no-cache + content-length: + - '399' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:27:21 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +- request: + body: '{"tags": {"key1": "value1"}, "sku": {"name": "Standard_S1", "tier": "Standard", + "capacity": 1}, "properties": {"features": [{"flag": "ServiceMode", "value": + "Serverless"}], "cors": {"allowedOrigins": ["https://foo.com", "https://bar.com"]}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '241' + Content-Type: + - application/json; charset=utf-8 + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + accept-language: + - en-US + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/signalR/myResource?api-version=2018-10-01 + response: + body: + string: '' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/46b1bca0-2afd-4469-9bd8-98dc39c0f8ec?api-version=2018-10-01 + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Apr 2020 14:27:23 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationResults/46b1bca0-2afd-4469-9bd8-98dc39c0f8ec/SignalR/myResource?api-version=2018-10-01 + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/46b1bca0-2afd-4469-9bd8-98dc39c0f8ec?api-version=2018-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/46b1bca0-2afd-4469-9bd8-98dc39c0f8ec","name":"46b1bca0-2afd-4469-9bd8-98dc39c0f8ec","status":"Succeeded","startTime":"2020-04-30T14:27:23.7689885Z","endTime":"2020-04-30T14:27:37.0229322Z"}' + headers: + cache-control: + - no-cache + content-length: + - '399' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:27:54 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/signalR/myResource?api-version=2018-10-01 + response: + body: + string: '{"sku":{"name":"Standard_S1","tier":"Standard","size":"S1","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"40.71.15.7","hostName":"myresource.service.signalr.net","publicPort":443,"serverPort":443,"version":"1.0","privateEndpointConnections":[],"hostNamePrefix":"myresource","features":[{"flag":"ServiceMode","value":"Serverless","properties":{}},{"flag":"EnableConnectivityLogs","value":"False","properties":{}},{"flag":"EnableMessagingLogs","value":"False","properties":{}}],"cors":{"allowedOrigins":["https://foo.com","https://bar.com"]},"upstream":{"templates":null},"networkACLs":{"defaultAction":"Deny","publicNetwork":{"allow":["ServerConnection","ClientConnection","RESTAPI"],"deny":null},"privateEndpoints":[]}},"location":"eastus","tags":{"key1":"value1"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/SignalR/myResource","name":"myResource","type":"Microsoft.SignalRService/SignalR","kind":"SignalR"}' + headers: + cache-control: + - no-cache + content-length: + - '1042' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:27:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +- request: + body: '{"type": "Microsoft.SignalRService/SignalR", "name": "my-signalr-service"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '74' + Content-Type: + - application/json; charset=utf-8 + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.SignalRService/locations/eastus/checkNameAvailability?api-version=2018-10-01 + response: + body: + string: '{"nameAvailable":true}' + headers: + cache-control: + - no-cache + content-length: + - '22' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:27:56 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + accept-language: + - en-US + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/signalR/myResource?api-version=2018-10-01 + response: + body: + string: '' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/c486d4b5-e2f6-48ca-99a1-042e94b19d60?api-version=2018-10-01 + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Apr 2020 14:27:58 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationResults/c486d4b5-e2f6-48ca-99a1-042e94b19d60/SignalR/myResource?api-version=2018-10-01 + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-signalr/0.3.0 Azure-SDK-For-Python + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/c486d4b5-e2f6-48ca-99a1-042e94b19d60?api-version=2018-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_signalr_test_signalrf5150df8/providers/Microsoft.SignalRService/locations/eastus/operationStatuses/myResource/operationId/c486d4b5-e2f6-48ca-99a1-042e94b19d60","name":"c486d4b5-e2f6-48ca-99a1-042e94b19d60","status":"Succeeded","startTime":"2020-04-30T14:27:58.2535948Z","endTime":"2020-04-30T14:28:06.539984Z"}' + headers: + cache-control: + - no-cache + content-length: + - '398' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 30 Apr 2020 14:28:28 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - afd9a794-0c74-4d7a-9baf-5982aa7d2e8c + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/signalr/azure-mgmt-signalr/tests/test_cli_mgmt_signalr.py b/sdk/signalr/azure-mgmt-signalr/tests/test_cli_mgmt_signalr.py new file mode 100644 index 000000000000..088154afe051 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/tests/test_cli_mgmt_signalr.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + + +# TEST SCENARIO COVERAGE +# ---------------------- +# Methods Total : 12 +# Methods Covered : 12 +# Examples Total : 12 +# Examples Tested : 12 +# Coverage % : 100 +# ---------------------- + +import unittest + +import azure.mgmt.signalr +from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer + +AZURE_LOCATION = 'eastus' + +class MgmtSignalRTest(AzureMgmtTestCase): + + def setUp(self): + super(MgmtSignalRTest, self).setUp() + self.mgmt_client = self.create_mgmt_client( + azure.mgmt.signalr.SignalRManagementClient + ) + + @ResourceGroupPreparer(location=AZURE_LOCATION) + def test_signalr(self, resource_group): + + SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID + TENANT_ID = self.settings.TENANT_ID + RESOURCE_GROUP = resource_group.name + LOCATION = "myLocation" + RESOURCE_NAME = "myResource" + + # /SignalR/put/SignalR_CreateOrUpdate[put] + BODY = { + 'tags': { + "key1": "value1" + }, + 'sku': { + "name": "Standard_S1", + "tier": "Standard", + "capacity": "1" + }, + 'properties': { + "features": [ + { + "flag": "ServiceMode", + "value": "Serverless" + } + ], + "cors": { + "allowed_origins": [ + "https://foo.com", + "https://bar.com" + ] + } + }, + 'location': 'eastus' + } + result = self.mgmt_client.signal_r.create_or_update(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY) + result = result.result() + + # /SignalR/get/SignalR_Get[get] + result = self.mgmt_client.signal_r.get(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME) + + # /SignalR/get/SignalR_ListByResourceGroup[get] + result = self.mgmt_client.signal_r.list_by_resource_group(resource_group_name=RESOURCE_GROUP) + + # /Usages/get/Usages_List[get] + result = self.mgmt_client.usages.list(location=LOCATION) + + # /SignalR/get/SignalR_ListBySubscription[get] + result = self.mgmt_client.signal_r.list_by_subscription() + + # /Operations/get/Operations_List[get] + result = self.mgmt_client.operations.list() + + # /SignalR/post/SignalR_RegenerateKey[post] + # result = self.mgmt_client.signal_r.regenerate_key(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, key_type="Primary") + # result = result.result() + + # /SignalR/post/SignalR_ListKeys[post] + result = self.mgmt_client.signal_r.list_keys(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME) + + # /SignalR/post/SignalR_Restart[post] + result = self.mgmt_client.signal_r.restart(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME) + result = result.result() + + # /SignalR/patch/SignalR_Update[patch] + BODY = { + "tags": { + "key1": "value1" + }, + "sku": { + "name": "Standard_S1", + "tier": "Standard", + "capacity": "1" + }, + "properties": { + "features": [ + { + "flag": "ServiceMode", + "value": "Serverless" + } + ], + "cors": { + "allowed_origins": [ + "https://foo.com", + "https://bar.com" + ] + } + } + } + result = self.mgmt_client.signal_r.update(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY) + result = result.result() + + # /SignalR/post/SignalR_CheckNameAvailability[post] + result = self.mgmt_client.signal_r.check_name_availability(location="eastus", type="Microsoft.SignalRService/SignalR", name="my-signalr-service") + + # /SignalR/delete/SignalR_Delete[delete] + result = self.mgmt_client.signal_r.delete(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME) + result = result.result() + + +#------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main()