Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/azure-cli-testsdk/azure/cli/testsdk/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def get_output_in_json(self):
if not self.json_value:
self.json_value = json.loads(self.output)

if not self.json_value:
if self.json_value is None:
raise AssertionError('The command output cannot be parsed in json.')

return self.json_value
Expand Down
6 changes: 0 additions & 6 deletions src/azure-cli-testsdk/azure/cli/testsdk/checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ def __init__(self, query, expected_result):

def __call__(self, execution_result):
json_value = execution_result.get_output_in_json()
if not json_value:
raise AssertionError('The command output cannot be parsed in json.')

actual_result = jmespath.search(self._query, json_value,
jmespath.Options(collections.OrderedDict))
if not actual_result == self._expected_result:
Expand All @@ -31,9 +28,6 @@ def __init__(self, query):

def __call__(self, execution_result):
json_value = execution_result.get_output_in_json()
if not json_value:
raise AssertionError('The command output cannot be parsed in json.')

actual_result = jmespath.search(self._query, json_value,
jmespath.Options(collections.OrderedDict))
if not actual_result:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
interactions:
- request:
body: '{"location": "westus", "tags": {"use": "az-test"}}'
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
CommandName: [group create]
Connection: [keep-alive]
Content-Length: ['50']
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.2 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.6
msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python
AZURECLI/2.0.0+dev]
accept-language: [en-US]
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2016-09-01
response:
body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'}
headers:
cache-control: [no-cache]
content-length: ['326']
content-type: [application/json; charset=utf-8]
date: ['Sat, 18 Mar 2017 20:50:16 GMT']
expires: ['-1']
pragma: [no-cache]
strict-transport-security: [max-age=31536000; includeSubDomains]
x-ms-ratelimit-remaining-subscription-writes: ['1198']
status: {code: 201, message: Created}
- request:
body: '{"sku": {"name": "Standard_LRS"}, "location": "westus", "kind": "Storage"}'
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
CommandName: [storage account create]
Connection: [keep-alive]
Content-Length: ['74']
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.2 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.6
msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.0+dev]
accept-language: [en-US]
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000002?api-version=2016-12-01
response:
body: {string: ''}
headers:
cache-control: [no-cache]
content-length: ['0']
date: ['Sat, 18 Mar 2017 20:50:20 GMT']
expires: ['-1']
location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/115eab74-1e65-49dc-9ba4-e84e5c05d27a?monitor=true&api-version=2016-12-01']
pragma: [no-cache]
retry-after: ['17']
server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0]
strict-transport-security: [max-age=31536000; includeSubDomains]
x-ms-ratelimit-remaining-subscription-writes: ['1199']
status: {code: 202, message: Accepted}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
CommandName: [storage account create]
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.2 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.6
msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.0+dev]
accept-language: [en-US]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/115eab74-1e65-49dc-9ba4-e84e5c05d27a?monitor=true&api-version=2016-12-01
response:
body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000002","kind":"Storage","location":"westus","name":"clitest000002","properties":{"creationTime":"2017-03-18T20:50:20.2003530Z","primaryEndpoints":{"blob":"https://clitest000002.blob.core.windows.net/","file":"https://clitest000002.file.core.windows.net/","queue":"https://clitest000002.queue.core.windows.net/","table":"https://clitest000002.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"}

'}
headers:
cache-control: [no-cache]
content-length: ['827']
content-type: [application/json]
date: ['Sat, 18 Mar 2017 20:50:37 GMT']
expires: ['-1']
pragma: [no-cache]
server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0]
strict-transport-security: [max-age=31536000; includeSubDomains]
transfer-encoding: [chunked]
vary: [Accept-Encoding]
status: {code: 200, message: OK}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
CommandName: [storage account generate-sas]
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.2 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.6
msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.0+dev]
accept-language: [en-US]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/storageAccounts?api-version=2016-12-01
response:
body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000002","kind":"Storage","location":"westus","name":"clitest000002","properties":{"creationTime":"2017-03-18T20:50:20.2003530Z","primaryEndpoints":{"blob":"https://clitest000002.blob.core.windows.net/","file":"https://clitest000002.file.core.windows.net/","queue":"https://clitest000002.queue.core.windows.net/","table":"https://clitest000002.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/foostore102","kind":"Storage","location":"westus","name":"foostore102","properties":{"creationTime":"2016-05-25T19:32:49.5192125Z","primaryEndpoints":{"blob":"https://foostore102.blob.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_ZRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/foostore103","kind":"Storage","location":"westus","name":"foostore103","properties":{"creationTime":"2016-05-25T23:52:18.1234838Z","primaryEndpoints":{"blob":"https://foostore103.blob.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_ZRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/foostore12978","kind":"Storage","location":"westeurope","name":"foostore12978","properties":{"creationTime":"2016-04-29T06:55:06.4412159Z","primaryEndpoints":{"blob":"https://foostore12978.blob.core.windows.net/","file":"https://foostore12978.file.core.windows.net/","queue":"https://foostore12978.queue.core.windows.net/","table":"https://foostore12978.table.core.windows.net/"},"primaryLocation":"westeurope","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/testacc209","kind":"Storage","location":"westus","name":"testacc209","properties":{"creationTime":"2016-01-26T19:04:16.5466637Z","primaryEndpoints":{"blob":"https://testacc209.blob.core.windows.net/","file":"https://testacc209.file.core.windows.net/","queue":"https://testacc209.queue.core.windows.net/","table":"https://testacc209.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/trdai-test-permanent/providers/Microsoft.Storage/storageAccounts/trdaitest01","kind":"Storage","location":"westus","name":"trdaitest01","properties":{"creationTime":"2017-03-03T18:45:52.4050116Z","primaryEndpoints":{"blob":"https://trdaitest01.blob.core.windows.net/","file":"https://trdaitest01.file.core.windows.net/","queue":"https://trdaitest01.queue.core.windows.net/","table":"https://trdaitest01.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/zitest","kind":"Storage","location":"westus","name":"zitest","properties":{"creationTime":"2016-05-03T20:07:05.3537460Z","primaryEndpoints":{"blob":"https://zitest.blob.core.windows.net/","file":"https://zitest.file.core.windows.net/","queue":"https://zitest.queue.core.windows.net/","table":"https://zitest.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/zitesta21","kind":"Storage","location":"westus","name":"zitesta21","properties":{"creationTime":"2016-08-23T20:01:18.8418933Z","primaryEndpoints":{"blob":"https://zitesta21.blob.core.windows.net/","file":"https://zitesta21.file.core.windows.net/","queue":"https://zitesta21.queue.core.windows.net/","table":"https://zitesta21.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/zitestb21","kind":"Storage","location":"westus","name":"zitestb21","properties":{"creationTime":"2016-08-23T20:10:50.2990885Z","primaryEndpoints":{"blob":"https://zitestb21.blob.core.windows.net/","file":"https://zitestb21.file.core.windows.net/","queue":"https://zitestb21.queue.core.windows.net/","table":"https://zitestb21.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/zitest/providers/Microsoft.Storage/storageAccounts/zitesty21","kind":"Storage","location":"westus","name":"zitesty21","properties":{"creationTime":"2016-08-23T19:55:37.1159138Z","primaryEndpoints":{"blob":"https://zitesty21.blob.core.windows.net/","file":"https://zitesty21.file.core.windows.net/","queue":"https://zitesty21.queue.core.windows.net/","table":"https://zitesty21.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"}]}

'}
headers:
cache-control: [no-cache]
content-length: ['6610']
content-type: [application/json]
date: ['Sat, 18 Mar 2017 20:50:38 GMT']
expires: ['-1']
pragma: [no-cache]
server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0]
strict-transport-security: [max-age=31536000; includeSubDomains]
transfer-encoding: [chunked]
vary: [Accept-Encoding]
status: {code: 200, message: OK}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
CommandName: [storage account generate-sas]
Connection: [keep-alive]
Content-Length: ['0']
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.2 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.6
msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.0+dev]
accept-language: [en-US]
method: POST
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000002/listKeys?api-version=2016-12-01
response:
body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"/H6HwyasXP56hSYVlfit4mqEDDsQZYdVeK0kMqDdYJoADfVM2wiH/+b5sA402kKKqIc1EovmJsUTDulhdL5r9A=="},{"keyName":"key2","permissions":"Full","value":"wJB7PHJsoMEUuaJNRmR92IBftPIaPvkAr/ehQGn2uht84wG90F3WRT1t700D8UKZWuED7g1dVd3ErPnV9Q4GDA=="}]}

'}
headers:
cache-control: [no-cache]
content-length: ['289']
content-type: [application/json]
date: ['Sat, 18 Mar 2017 20:50:40 GMT']
expires: ['-1']
pragma: [no-cache]
server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0]
strict-transport-security: [max-age=31536000; includeSubDomains]
transfer-encoding: [chunked]
vary: [Accept-Encoding]
x-ms-ratelimit-remaining-subscription-writes: ['1199']
status: {code: 200, message: OK}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
CommandName: [group delete]
Connection: [keep-alive]
Content-Length: ['0']
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.2 (Darwin-16.4.0-x86_64-i386-64bit) requests/2.9.1 msrest/0.4.6
msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python
AZURECLI/2.0.0+dev]
accept-language: [en-US]
method: DELETE
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2016-09-01
response:
body: {string: ''}
headers:
cache-control: [no-cache]
content-length: ['0']
date: ['Sat, 18 Mar 2017 20:50:43 GMT']
expires: ['-1']
location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkcxODM3ODhCNzU2QkIwMUMzMEYzMTA5NUEzOUIwMDBERTNDRHw2OTczQkU1RURDRDlFQjY0LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01']
pragma: [no-cache]
retry-after: ['15']
strict-transport-security: [max-age=31536000; includeSubDomains]
x-ms-ratelimit-remaining-subscription-writes: ['1199']
status: {code: 202, message: Accepted}
version: 1
Loading