Skip to content
Prev Previous commit
Next Next commit
Add very basic tests
  • Loading branch information
bgklein committed May 26, 2020
commit accff464f1aec62cf9dfd8b4c2dace7bf142f2e4
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def register_providers():
_register_one_provider('Microsoft.DocumentDB/databaseAccounts', '2019-08-01-preview', False, '2020-03-01')
_register_one_provider('Microsoft.Devices/IotHubs', '2020-03-01', True)


def _register_one_provider(provider, api_version, support_list_or_not, resource_get_api_version=None):
"""
:param provider: namespace + type.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
interactions:
- request:
body: '{"location": "southcentralus"}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- batch account create
Connection:
- keep-alive
Content-Length:
- '30'
Content-Type:
- application/json; charset=utf-8
ParameterSetName:
- -n -g -l
User-Agent:
- python/3.7.5 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3
azure-mgmt-batch/8.0.0 Azure-SDK-For-Python AZURECLI/2.5.1
accept-language:
- en-US
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Batch/batchAccounts/clibatch000002?api-version=2020-03-01
response:
body:
string: ''
headers:
cache-control:
- no-cache
content-length:
- '0'
date:
- Wed, 13 May 2020 02:58:12 GMT
expires:
- '-1'
location:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Batch/batchAccounts/clibatch000002/operationResults/80719a3c-7f85-4c00-a7a5-4239bdf3d86a?api-version=2020-03-01
pragma:
- no-cache
server:
- Microsoft-HTTPAPI/2.0
strict-transport-security:
- max-age=31536000; includeSubDomains
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1199'
status:
code: 202
message: Accepted
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- batch account create
Connection:
- keep-alive
ParameterSetName:
- -n -g -l
User-Agent:
- python/3.7.5 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3
azure-mgmt-batch/8.0.0 Azure-SDK-For-Python AZURECLI/2.5.1
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Batch/batchAccounts/clibatch000002/operationResults/80719a3c-7f85-4c00-a7a5-4239bdf3d86a?api-version=2020-03-01
response:
body:
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Batch/batchAccounts/clibatch000002","name":"clibatch000002","type":"Microsoft.Batch/batchAccounts","location":"southcentralus","properties":{"accountEndpoint":"clibatch000002.southcentralus.batch.azure.com","provisioningState":"Succeeded","dedicatedCoreQuota":700,"dedicatedCoreQuotaPerVMFamily":[{"name":"standardAv2Family","coreQuota":100},{"name":"standardDv2Family","coreQuota":100},{"name":"standardDv3Family","coreQuota":100},{"name":"standardEv3Family","coreQuota":50},{"name":"standardDSv2Family","coreQuota":100},{"name":"standardDSv3Family","coreQuota":100},{"name":"standardESv3Family","coreQuota":50},{"name":"standardFFamily","coreQuota":50},{"name":"standardFSFamily","coreQuota":50},{"name":"standardA0_A7Family","coreQuota":0},{"name":"standardA8_A11Family","coreQuota":0},{"name":"standardDFamily","coreQuota":0},{"name":"standardGFamily","coreQuota":0},{"name":"basicAFamily","coreQuota":0},{"name":"standardNVFamily","coreQuota":0},{"name":"standardNVPromoFamily","coreQuota":0},{"name":"standardNCFamily","coreQuota":0},{"name":"standardNCPromoFamily","coreQuota":0},{"name":"standardHFamily","coreQuota":0},{"name":"standardHPromoFamily","coreQuota":0},{"name":"standardMSFamily","coreQuota":0},{"name":"standardDSFamily","coreQuota":0},{"name":"standardGSFamily","coreQuota":0},{"name":"standardLSFamily","coreQuota":0},{"name":"standardLSv2Family","coreQuota":0},{"name":"standardNCSv2Family","coreQuota":0},{"name":"standardNDSFamily","coreQuota":0},{"name":"standardNCSv3Family","coreQuota":0},{"name":"standardFSv2Family","coreQuota":0},{"name":"standardHBSFamily","coreQuota":0},{"name":"standardHCSFamily","coreQuota":0},{"name":"standardNVSv3Family","coreQuota":0},{"name":"standardHBrsv2Family","coreQuota":0},{"name":"standardDASv4Family","coreQuota":0},{"name":"standardEAv4Family","coreQuota":0},{"name":"standardEASv4Family","coreQuota":0}],"dedicatedCoreQuotaPerVMFamilyEnforced":false,"lowPriorityCoreQuota":500,"poolQuota":100,"activeJobAndJobScheduleQuota":300,"poolAllocationMode":"BatchService","publicNetworkAccess":"Enabled","encryption":{"keySource":"Microsoft.Batch"}}}'
headers:
cache-control:
- no-cache
content-length:
- '2313'
content-type:
- application/json; charset=utf-8
date:
- Wed, 13 May 2020 02:58:27 GMT
etag:
- '"0x8D7F6E982FF867C"'
expires:
- '-1'
last-modified:
- Wed, 13 May 2020 02:58:28 GMT
pragma:
- no-cache
server:
- Microsoft-HTTPAPI/2.0
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
CommandName:
- network private-endpoint-connection list
Connection:
- keep-alive
ParameterSetName:
- --name -g --type
User-Agent:
- AZURECLI/2.5.1
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Batch/batchAccounts/clibatch000002/privateEndpointConnections?api-version=2020-03-01
response:
body:
string: '{"value":[]}'
headers:
cache-control:
- no-cache
content-length:
- '12'
content-type:
- application/json; charset=utf-8
date:
- Wed, 13 May 2020 02:58:30 GMT
expires:
- '-1'
pragma:
- no-cache
server:
- Microsoft-HTTPAPI/2.0
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
interactions:
- request:
body: '{"location": "northcentralus"}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- batch account create
Connection:
- keep-alive
Content-Length:
- '30'
Content-Type:
- application/json; charset=utf-8
ParameterSetName:
- -n -g -l
User-Agent:
- python/3.7.5 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3
azure-mgmt-batch/8.0.0 Azure-SDK-For-Python AZURECLI/2.5.1
accept-language:
- en-US
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Batch/batchAccounts/clibatch000002?api-version=2020-03-01
response:
body:
string: ''
headers:
cache-control:
- no-cache
content-length:
- '0'
date:
- Wed, 13 May 2020 02:58:33 GMT
expires:
- '-1'
location:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Batch/batchAccounts/clibatch000002/operationResults/274ecc5b-6f51-4598-82b3-c5fd57239bf6?api-version=2020-03-01
pragma:
- no-cache
server:
- Microsoft-HTTPAPI/2.0
strict-transport-security:
- max-age=31536000; includeSubDomains
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1199'
status:
code: 202
message: Accepted
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- batch account create
Connection:
- keep-alive
ParameterSetName:
- -n -g -l
User-Agent:
- python/3.7.5 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3
azure-mgmt-batch/8.0.0 Azure-SDK-For-Python AZURECLI/2.5.1
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Batch/batchAccounts/clibatch000002/operationResults/274ecc5b-6f51-4598-82b3-c5fd57239bf6?api-version=2020-03-01
response:
body:
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Batch/batchAccounts/clibatch000002","name":"clibatch000002","type":"Microsoft.Batch/batchAccounts","location":"northcentralus","properties":{"accountEndpoint":"clibatch000002.northcentralus.batch.azure.com","provisioningState":"Succeeded","dedicatedCoreQuota":0,"dedicatedCoreQuotaPerVMFamily":[{"name":"standardAv2Family","coreQuota":0},{"name":"standardDv2Family","coreQuota":0},{"name":"standardDv3Family","coreQuota":0},{"name":"standardEv3Family","coreQuota":0},{"name":"standardDSv2Family","coreQuota":0},{"name":"standardDSv3Family","coreQuota":0},{"name":"standardESv3Family","coreQuota":0},{"name":"standardFFamily","coreQuota":0},{"name":"standardFSFamily","coreQuota":0},{"name":"standardA0_A7Family","coreQuota":0},{"name":"standardA8_A11Family","coreQuota":0},{"name":"standardDFamily","coreQuota":0},{"name":"standardGFamily","coreQuota":0},{"name":"basicAFamily","coreQuota":0},{"name":"standardNVFamily","coreQuota":0},{"name":"standardNVPromoFamily","coreQuota":0},{"name":"standardNCFamily","coreQuota":0},{"name":"standardNCPromoFamily","coreQuota":0},{"name":"standardHFamily","coreQuota":0},{"name":"standardHPromoFamily","coreQuota":0},{"name":"standardMSFamily","coreQuota":0},{"name":"standardDSFamily","coreQuota":0},{"name":"standardGSFamily","coreQuota":0},{"name":"standardLSFamily","coreQuota":0},{"name":"standardLSv2Family","coreQuota":0},{"name":"standardNCSv2Family","coreQuota":0},{"name":"standardNDSFamily","coreQuota":0},{"name":"standardNCSv3Family","coreQuota":0},{"name":"standardFSv2Family","coreQuota":0},{"name":"standardHBSFamily","coreQuota":0},{"name":"standardHCSFamily","coreQuota":0},{"name":"standardNVSv3Family","coreQuota":0},{"name":"standardHBrsv2Family","coreQuota":0},{"name":"standardDASv4Family","coreQuota":0},{"name":"standardEAv4Family","coreQuota":0},{"name":"standardEASv4Family","coreQuota":0}],"dedicatedCoreQuotaPerVMFamilyEnforced":false,"lowPriorityCoreQuota":0,"poolQuota":100,"activeJobAndJobScheduleQuota":300,"poolAllocationMode":"BatchService","publicNetworkAccess":"Enabled","encryption":{"keySource":"Microsoft.Batch"}}}'
headers:
cache-control:
- no-cache
content-length:
- '2295'
content-type:
- application/json; charset=utf-8
date:
- Wed, 13 May 2020 02:58:49 GMT
etag:
- '"0x8D7F6E98FE66DA5"'
expires:
- '-1'
last-modified:
- Wed, 13 May 2020 02:58:49 GMT
pragma:
- no-cache
server:
- Microsoft-HTTPAPI/2.0
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
CommandName:
- network private-link-resource list
Connection:
- keep-alive
ParameterSetName:
- --name -g --type
User-Agent:
- AZURECLI/2.5.1
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Batch/batchAccounts/clibatch000002/privateLinkResources?api-version=2020-03-01
response:
body:
string: '{"value":[]}'
headers:
cache-control:
- no-cache
content-length:
- '12'
content-type:
- application/json; charset=utf-8
date:
- Wed, 13 May 2020 02:58:51 GMT
expires:
- '-1'
pragma:
- no-cache
server:
- Microsoft-HTTPAPI/2.0
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from azure.cli.command_modules.keyvault.tests.latest.test_keyvault_commands import _create_keyvault
from azure.cli.command_modules.rdbms.tests.latest.test_rdbms_commands import ServerPreparer
from azure.cli.command_modules.batch.tests.latest.batch_preparers import BatchAccountPreparer, BatchScenarioMixin


class NetworkPrivateLinkKeyVaultScenarioTest(ScenarioTest):
Expand Down Expand Up @@ -597,6 +598,25 @@ def _test_private_endpoint_connection(self, resource_group, server, database_eng
.format(server_pec_id))


class NetworkPrivateLinkBatchAccountScenarioTest(ScenarioTest, BatchScenarioMixin):
# Currently private-link-resource and private-endpoint-connection are whitelist only features so scenario tests are limited
@ResourceGroupPreparer()
@BatchAccountPreparer(location='northcentralus')
def test_private_link_resource_batch_account(self, resource_group, batch_account_name):
self.kwargs.update({
'ba': batch_account_name,
'rg': resource_group})
self.cmd('network private-link-resource list --name {ba} -g {rg} --type Microsoft.Batch/batchAccounts')

@ResourceGroupPreparer()
@BatchAccountPreparer(location='southcentralus')
def test_private_endpoint_connection_batch_account(self, resource_group, batch_account_name):
self.kwargs.update({
'ba': batch_account_name,
'rg': resource_group})
self.cmd('network private-endpoint-connection list --name {ba} -g {rg} --type Microsoft.Batch/batchAccounts')


class NetworkPrivateLinkCosmosDBScenarioTest(ScenarioTest):
@ResourceGroupPreparer(name_prefix='cli_test_cosmosdb_plr')
def test_private_link_resource_cosmosdb(self, resource_group):
Expand Down