diff --git a/azure-mgmt-datalake-store/tests/recordings/test_mgmt_datalake_store.test_vnet_operations.yaml b/azure-mgmt-datalake-store/tests/recordings/test_mgmt_datalake_store.test_vnet_operations.yaml new file mode 100644 index 000000000000..14d1e6e26cf8 --- /dev/null +++ b/azure-mgmt-datalake-store/tests/recordings/test_mgmt_datalake_store.test_vnet_operations.yaml @@ -0,0 +1,237 @@ +interactions: +- request: + body: '{"location": "East US 2", "properties": {"virtualNetworkRules": [{"name": + "vnetrule1ab2612a4", "properties": {"subnetId": "/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.Network/virtualNetworks/lewuVNET/subnets/default"}}], + "firewallState": "Enabled", "firewallAllowAzureIps": "Enabled"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['336'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.14393-SP0) requests/2.18.4 msrest/0.4.29 + msrest_azure/0.4.31 azure-mgmt-datalake-store/2016-11-01 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4?api-version=2016-11-01 + response: + body: {string: '{"properties":{"firewallState":"Enabled","firewallAllowAzureIps":"Enabled","firewallAllowDataLakeAnalytics":"Enabled","virtualNetworkRules":[{"properties":{"subnetId":"/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.Network/virtualNetworks/lewuVNET/subnets/default"},"name":"vnetrule1ab2612a4"}],"provisioningState":"Patching","state":"Active","endpoint":"adlsacctab2612a4.azuredatalakestore.net","accountId":"4c7674bc-2170-4e62-a6e0-877ffcf5f02f","creationTime":"2018-05-31T00:54:06.7380774Z","lastModifiedTime":"2018-05-31T03:03:14.5419411Z"},"location":"East + US 2","id":"/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4","name":"adlsacctab2612a4","type":"Microsoft.DataLakeStore/accounts"}'} + headers: + azure-asyncoperation: ['https://management.azure.com/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/providers/Microsoft.DataLakeStore/locations/EastUS2/operationResults/4c7674bc-2170-4e62-a6e0-877ffcf5f02f24?api-version=2016-11-01&expanded=true'] + cache-control: [no-cache] + content-length: ['825'] + content-type: [application/json] + date: ['Thu, 31 May 2018 03:32:41 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourcegroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4/operationresults/24?api-version=2016-11-01'] + 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-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python/3.6.4 (Windows-10-10.0.14393-SP0) requests/2.18.4 msrest/0.4.29 + msrest_azure/0.4.31 azure-mgmt-datalake-store/2016-11-01 Azure-SDK-For-Python] + method: GET + uri: https://management.azure.com/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/providers/Microsoft.DataLakeStore/locations/EastUS2/operationResults/4c7674bc-2170-4e62-a6e0-877ffcf5f02f24?api-version=2016-11-01&expanded=true + response: + body: {string: '{"status":"Succeeded"}'} + headers: + cache-control: [no-cache] + content-length: ['22'] + content-type: [application/json] + date: ['Thu, 31 May 2018 03:32:52 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-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python/3.6.4 (Windows-10-10.0.14393-SP0) requests/2.18.4 msrest/0.4.29 + msrest_azure/0.4.31 azure-mgmt-datalake-store/2016-11-01 Azure-SDK-For-Python] + method: GET + uri: https://management.azure.com/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4?api-version=2016-11-01 + response: + body: {string: '{"properties":{"firewallState":"Enabled","firewallAllowAzureIps":"Enabled","firewallAllowDataLakeAnalytics":"Enabled","firewallRules":[],"virtualNetworkRules":[{"properties":{"subnetId":"/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.Network/virtualNetworks/lewuVNET/subnets/default","state":"Active"},"name":"vnetrule1ab2612a4"}],"trustedIdProviderState":"Disabled","trustedIdProviders":[],"encryptionState":"Enabled","encryptionConfig":{"type":"ServiceManaged"},"currentTier":"Consumption","newTier":"Consumption","provisioningState":"Succeeded","state":"Active","endpoint":"adlsacctab2612a4.azuredatalakestore.net","accountId":"4c7674bc-2170-4e62-a6e0-877ffcf5f02f","creationTime":"2018-05-31T00:54:06.7380774Z","lastModifiedTime":"2018-05-31T03:32:42.5393577Z"},"location":"East + US 2","id":"/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4","name":"adlsacctab2612a4","type":"Microsoft.DataLakeStore/accounts"}'} + headers: + cache-control: [no-cache] + content-length: ['1047'] + content-type: [application/json] + date: ['Thu, 31 May 2018 03:32:53 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-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.14393-SP0) requests/2.18.4 msrest/0.4.29 + msrest_azure/0.4.31 azure-mgmt-datalake-store/2016-11-01 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4?api-version=2016-11-01 + response: + body: {string: '{"properties":{"firewallState":"Enabled","firewallAllowAzureIps":"Enabled","firewallAllowDataLakeAnalytics":"Enabled","firewallRules":[],"virtualNetworkRules":[{"properties":{"subnetId":"/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.Network/virtualNetworks/lewuVNET/subnets/default","state":"Active"},"name":"vnetrule1ab2612a4"}],"trustedIdProviderState":"Disabled","trustedIdProviders":[],"encryptionState":"Enabled","encryptionConfig":{"type":"ServiceManaged"},"currentTier":"Consumption","newTier":"Consumption","provisioningState":"Succeeded","state":"Active","endpoint":"adlsacctab2612a4.azuredatalakestore.net","accountId":"4c7674bc-2170-4e62-a6e0-877ffcf5f02f","creationTime":"2018-05-31T00:54:06.7380774Z","lastModifiedTime":"2018-05-31T03:32:42.5393577Z"},"location":"East + US 2","id":"/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4","name":"adlsacctab2612a4","type":"Microsoft.DataLakeStore/accounts"}'} + headers: + cache-control: [no-cache] + content-length: ['1047'] + content-type: [application/json] + date: ['Thu, 31 May 2018 03:32:53 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-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.14393-SP0) requests/2.18.4 msrest/0.4.29 + msrest_azure/0.4.31 azure-mgmt-datalake-store/2016-11-01 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4/virtualNetworkRules/vnetrule1ab2612a4?api-version=2016-11-01 + response: + body: {string: '{"properties":{"subnetId":"/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.Network/virtualNetworks/lewuVNET/subnets/default","state":"Active"},"id":"/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4/virtualNetworkRules/vnetrule1ab2612a4","name":"vnetrule1ab2612a4","type":"Microsoft.DataLakeStore/accounts/virtualNetworkRules"}'} + headers: + cache-control: [no-cache] + content-length: ['459'] + content-type: [application/json] + date: ['Thu, 31 May 2018 03:32:54 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-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"subnetId": "/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.Network/virtualNetworks/lewuVNET/subnets/updatedSubnetId"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['183'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.14393-SP0) requests/2.18.4 msrest/0.4.29 + msrest_azure/0.4.31 azure-mgmt-datalake-store/2016-11-01 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4/virtualNetworkRules/vnetrule1ab2612a4?api-version=2016-11-01 + response: + body: {string: '{"properties":{"subnetId":"/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.Network/virtualNetworks/lewuVNET/subnets/updatedSubnetId"},"id":"/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4/virtualNetworkRules/vnetrule1ab2612a4","name":"vnetrule1ab2612a4","type":"Microsoft.DataLakeStore/accounts/virtualNetworkRules"}'} + headers: + cache-control: [no-cache] + content-length: ['450'] + content-type: [application/json] + date: ['Thu, 31 May 2018 03:32:57 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-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.14393-SP0) requests/2.18.4 msrest/0.4.29 + msrest_azure/0.4.31 azure-mgmt-datalake-store/2016-11-01 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4/virtualNetworkRules/vnetrule1ab2612a4?api-version=2016-11-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Thu, 31 May 2018 03:32:59 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-remaining-subscription-deletes: ['14999'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.14393-SP0) requests/2.18.4 msrest/0.4.29 + msrest_azure/0.4.31 azure-mgmt-datalake-store/2016-11-01 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.DataLakeStore/accounts/adlsacctab2612a4/virtualNetworkRules/vnetrule1ab2612a4?api-version=2016-11-01 + response: + body: {string: '{"error":{"code":"NestedResourceNotFound","message":"Nested resource + does not exist."}}'} + headers: + cache-control: [no-cache] + content-length: ['87'] + content-type: [application/json] + date: ['Thu, 31 May 2018 03:33: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-powered-by: [ASP.NET] + status: {code: 404, message: Not Found} +version: 1 diff --git a/azure-mgmt-datalake-store/tests/test_mgmt_datalake_store.py b/azure-mgmt-datalake-store/tests/test_mgmt_datalake_store.py index 4ea60f1f60a3..673a7df64aae 100644 --- a/azure-mgmt-datalake-store/tests/test_mgmt_datalake_store.py +++ b/azure-mgmt-datalake-store/tests/test_mgmt_datalake_store.py @@ -6,9 +6,12 @@ # license information. #-------------------------------------------------------------------------- import unittest - +import adal import azure.mgmt.datalake.store from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer +from msrestazure.azure_active_directory import AADTokenCredentials +from msrestazure.azure_exceptions import CloudError +from azure.mgmt.datalake.store import models # this is the ADL produciton region for now _REGION = 'East US 2' @@ -21,25 +24,116 @@ def setUp(self): azure.mgmt.datalake.store.DataLakeStoreAccountManagementClient ) + @ResourceGroupPreparer(location=_REGION) + def test_vnet_operations(self, location): + account_name = self.get_resource_name('adlsacct') + vnet_rule_name = self.get_resource_name('vnetrule1') + resource_group = 'lewu-rg' + subnet_id = '/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.Network/virtualNetworks/lewuVNET/subnets/default' + subscription_id = '9e1f0ab2-2f85-49de-9677-9da6f829b914' + + authority_host_uri = 'https://login.microsoftonline.com' + tenant = '72f988bf-86f1-41af-91ab-2d7cd011db47' + authority_uri = authority_host_uri + '/' + tenant + RESOURCE = 'https://management.core.windows.net/' + client_id = '565a758f-4919-40b8-af45-765cbb13664a' + client_secret = 'ycCDVcjcBuOwwroCdtlo4ZNzMoJ3iQ70JQExHmL8LnA=' + + context = adal.AuthenticationContext(authority_uri, api_version=None) + mgmt_token = context.acquire_token_with_client_credentials(RESOURCE, client_id, client_secret) + armCreds = AADTokenCredentials(mgmt_token, client_id, resource=RESOURCE) + + adls_mgmt_account_client = azure.mgmt.datalake.store.DataLakeStoreAccountManagementClient(armCreds, subscription_id) + + virtual_network_rule = models.CreateVirtualNetworkRuleWithAccountParameters( + name = vnet_rule_name, + subnet_id = subnet_id + ) + + params_create = models.CreateDataLakeStoreAccountParameters( + location = location, + firewall_state = models.FirewallState.enabled, + firewall_allow_azure_ips = models.FirewallAllowAzureIpsState.enabled, + virtual_network_rules = [virtual_network_rule] + ) + + # create and validate an ADLS account + response_create = adls_mgmt_account_client.accounts.create( + resource_group, + account_name, + params_create, + ).result() + self.assertEqual(models.DataLakeStoreAccountStatus.succeeded, response_create.provisioning_state) + + # get the account and ensure that all the values are properly set + response_get = adls_mgmt_account_client.accounts.get( + resource_group, + account_name + ) + + # Validate the account creation process + self.assertEqual(models.DataLakeStoreAccountStatus.succeeded, response_get.provisioning_state) + self.assertEqual(response_get.name, account_name) + + # Validate firewall state + self.assertEqual(models.FirewallState.enabled, response_get.firewall_state) + self.assertEqual(models.FirewallAllowAzureIpsState.enabled, response_get.firewall_allow_azure_ips) + + # Validate virtual network state + self.assertEqual(1, len(response_get.virtual_network_rules)) + self.assertEqual(vnet_rule_name, response_get.virtual_network_rules[0].name) + self.assertEqual(subnet_id, response_get.virtual_network_rules[0].subnet_id) + + vnet_rule = adls_mgmt_account_client.virtual_network_rules.get( + resource_group, + account_name, + vnet_rule_name + ) + self.assertEqual(vnet_rule_name, vnet_rule.name) + self.assertEqual(subnet_id, vnet_rule.subnet_id) + + updated_subnet_id = '/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.Network/virtualNetworks/lewuVNET/subnets/updatedSubnetId' + + # Update the virtual network rule to change the subnetId + vnet_rule = adls_mgmt_account_client.virtual_network_rules.create_or_update( + resource_group, + account_name, + vnet_rule_name, + updated_subnet_id + ) + self.assertEqual(updated_subnet_id, vnet_rule.subnet_id) + + # Remove the virtual network rule and verify it is gone + adls_mgmt_account_client.virtual_network_rules.delete( + resource_group, + account_name, + vnet_rule_name + ) + self.assertRaises(CloudError, lambda: adls_mgmt_account_client.virtual_network_rules.get( + resource_group, + account_name, + vnet_rule_name + )) + @ResourceGroupPreparer(location=_REGION) def test_adls_accounts(self, resource_group, location): # define account params account_name = self.get_resource_name('pyarmadls') account_name_no_encryption = self.get_resource_name('pyarmadls2') - params_create = azure.mgmt.datalake.store.models.CreateDataLakeStoreAccountParameters( + params_create = models.CreateDataLakeStoreAccountParameters( location = location, - identity = azure.mgmt.datalake.store.models.EncryptionIdentity(), - encryption_config = azure.mgmt.datalake.store.models.EncryptionConfig( - type = azure.mgmt.datalake.store.models.EncryptionConfigType.service_managed + identity = models.EncryptionIdentity(), + encryption_config = models.EncryptionConfig( + type = models.EncryptionConfigType.service_managed ), - encryption_state = azure.mgmt.datalake.store.models.EncryptionState.enabled, + encryption_state = models.EncryptionState.enabled, tags = { 'tag1' : 'value1' } ) - params_create_no_encryption = azure.mgmt.datalake.store.models.CreateDataLakeStoreAccountParameters( + params_create_no_encryption = models.CreateDataLakeStoreAccountParameters( location = location, tags = { 'tag1' : 'value1' @@ -48,7 +142,7 @@ def test_adls_accounts(self, resource_group, location): # ensure that the account name is available name_availability = self.adls_account_client.accounts.check_name_availability( - location.replace(" ", ""), + location.replace(" ", ""), account_name ) self.assertTrue(name_availability.name_available) @@ -62,20 +156,20 @@ def test_adls_accounts(self, resource_group, location): # ensure that the account name is no longer available name_availability = self.adls_account_client.accounts.check_name_availability( - location.replace(" ", ""), + location.replace(" ", ""), account_name ) self.assertFalse(name_availability.name_available) - + # full validation of the create self.assertEqual(adls_account.name, account_name) - self.assertEqual(azure.mgmt.datalake.store.models.DataLakeStoreAccountStatus.succeeded, adls_account.provisioning_state) + self.assertEqual(models.DataLakeStoreAccountStatus.succeeded, adls_account.provisioning_state) self.assertIsNotNone(adls_account.id) self.assertIn(account_name, adls_account.id) self.assertIn(account_name, adls_account.endpoint) self.assertEqual(location, adls_account.location) self.assertEqual('Microsoft.DataLakeStore/accounts', adls_account.type) - self.assertEqual(azure.mgmt.datalake.store.models.EncryptionState.enabled, adls_account.encryption_state) + self.assertEqual(models.EncryptionState.enabled, adls_account.encryption_state) self.assertEqual('SystemAssigned', adls_account.identity.type) self.assertIsNotNone(adls_account.identity.principal_id) self.assertIsNotNone(adls_account.identity.tenant_id) @@ -89,13 +183,13 @@ def test_adls_accounts(self, resource_group, location): # full validation self.assertEqual(adls_account.name, account_name) - self.assertEqual(azure.mgmt.datalake.store.models.DataLakeStoreAccountStatus.succeeded, adls_account.provisioning_state) + self.assertEqual(models.DataLakeStoreAccountStatus.succeeded, adls_account.provisioning_state) self.assertIsNotNone(adls_account.id) self.assertIn(account_name, adls_account.id) self.assertIn(account_name, adls_account.endpoint) self.assertEqual(location, adls_account.location) self.assertEqual('Microsoft.DataLakeStore/accounts', adls_account.type) - self.assertEqual(azure.mgmt.datalake.store.models.EncryptionState.enabled, adls_account.encryption_state) + self.assertEqual(models.EncryptionState.enabled, adls_account.encryption_state) self.assertEqual('SystemAssigned', adls_account.identity.type) self.assertIsNotNone(adls_account.identity.principal_id) self.assertIsNotNone(adls_account.identity.tenant_id) @@ -116,13 +210,13 @@ def test_adls_accounts(self, resource_group, location): # full validation of the create self.assertEqual(adls_account_no_encryption.name, account_name_no_encryption) - self.assertEqual(azure.mgmt.datalake.store.models.DataLakeStoreAccountStatus.succeeded, adls_account_no_encryption.provisioning_state) + self.assertEqual(models.DataLakeStoreAccountStatus.succeeded, adls_account_no_encryption.provisioning_state) self.assertIsNotNone(adls_account_no_encryption.id) self.assertIn(account_name_no_encryption, adls_account_no_encryption.id) self.assertIn(account_name_no_encryption, adls_account_no_encryption.endpoint) self.assertEqual(location, adls_account_no_encryption.location) self.assertEqual('Microsoft.DataLakeStore/accounts', adls_account_no_encryption.type) - self.assertEqual(azure.mgmt.datalake.store.models.EncryptionState.enabled, adls_account_no_encryption.encryption_state) + self.assertEqual(models.EncryptionState.enabled, adls_account_no_encryption.encryption_state) self.assertIsNone(adls_account_no_encryption.identity) self.assertEqual(adls_account_no_encryption.tags['tag1'], 'value1') @@ -137,7 +231,7 @@ def test_adls_accounts(self, resource_group, location): adls_account = self.adls_account_client.accounts.update( resource_group.name, account_name, - azure.mgmt.datalake.store.models.UpdateDataLakeStoreAccountParameters( + models.UpdateDataLakeStoreAccountParameters( tags = { 'tag2' : 'value2' } @@ -145,15 +239,15 @@ def test_adls_accounts(self, resource_group, location): ).result() self.assertEqual(adls_account.tags['tag2'], 'value2') - - # confirm that 'locations.get_capability' is functional + + # confirm that 'locations.get_capability' is functional get_capability = self.adls_account_client.locations.get_capability(location.replace(" ", "")) self.assertIsNotNone(get_capability) # confirm that 'operations.list' is functional operations_list = self.adls_account_client.operations.list() self.assertIsNotNone(operations_list) - + self.adls_account_client.accounts.delete( resource_group.name, account_name