code stringlengths 3 6.57k |
|---|
self.assertEqual(resp.status_code, status_code) |
json.loads(str(resp.data.decode() |
except (TypeError, ValueError) |
resp.data.decode() |
_test_get_status(self, url, status_code=200) |
self._test_status(url, 'GET', None, status_code, None) |
_test_post_status(self, url, data, status_code=201, content_type='application/json') |
self._test_status(url, 'POST', data, status_code, content_type) |
_test_put_status(self, url, data, status_code=204, content_type='application/json') |
self._test_status(url, 'PUT', data, status_code, content_type) |
_test_delete_status(self, url, status_code=204) |
self._test_status(url, 'DELETE', None, status_code, None) |
Copyright (c) |
MgmtBatchTest(AzureMgmtTestCase) |
setUp(self) |
super(MgmtBatchTest, self) |
setUp() |
_get_account_name(self) |
self.get_resource_name('batch') |
test_mgmt_batch_list_operations(self) |
self.mgmt_batch_client.operations.list() |
list(operations) |
self.assertEqual(len(all_ops) |
self.assertEqual(all_ops[0].name, 'Microsoft.Batch/batchAccounts/providers/Microsoft.Insights/diagnosticSettings/read') |
self.assertEqual(all_ops[0].origin, 'system') |
self.assertEqual(all_ops[0].display.provider, 'Microsoft Batch') |
self.assertEqual(all_ops[0].display.operation, 'Read diagnostic setting') |
test_mgmt_batch_subscription_quota(self) |
self.mgmt_batch_client.location.get_quotas(AZURE_LOCATION) |
self.assertIsInstance(quotas, models.BatchLocationQuota) |
self.assertEqual(quotas.account_quota, 3) |
test_mgmt_batch_account_name(self) |
self.assertIsInstance(availability, models.CheckNameAvailabilityResult) |
self.assertFalse(availability.name_available) |
self.assertEqual(availability.reason, models.NameAvailabilityReason.invalid) |
self.assertIsInstance(availability, models.CheckNameAvailabilityResult) |
self.assertFalse(availability.name_available) |
self.assertEqual(availability.reason, models.NameAvailabilityReason.already_exists) |
self._get_account_name() |
self.assertIsInstance(availability, models.CheckNameAvailabilityResult) |
self.assertTrue(availability.name_available) |
ResourceGroupPreparer(location=AZURE_LOCATION) |
KeyVaultPreparer(location=AZURE_LOCATION) |
test_mgmt_batch_byos_account(self, resource_group, location, keyvault) |
keyvault.result() |
self.assertRaises(Exception) |
self._get_account_name() |
creating.result() |
format(keyvault.name) |
self._get_account_name() |
creating.result() |
ResourceGroupPreparer(location=AZURE_LOCATION) |
test_mgmt_batch_account(self, resource_group, location) |
self._get_account_name() |
account_setup.result() |
self.mgmt_batch_client.batch_account.get(resource_group.name, account_name) |
self.assertEqual(account.dedicated_core_quota, 20) |
self.assertEqual(account.low_priority_core_quota, 100) |
self.assertEqual(account.pool_quota, 100) |
self.assertEqual(account.pool_allocation_mode.value, 'BatchService') |
self.mgmt_batch_client.batch_account.list_by_resource_group(resource_group.name) |
self.assertEqual(len(list(accounts) |
self.mgmt_batch_client.batch_account.get_keys(resource_group.name, account_name) |
self.assertIsInstance(keys, models.BatchAccountKeys) |
self.assertEqual(keys.account_name, account_name) |
self.assertIsInstance(keys, models.BatchAccountKeys) |
self.assertFalse(keys.secondary == secondary) |
self.mgmt_batch_client.batch_account.update(resource_group.name, account_name, update_tags) |
self.assertIsInstance(updated, models.BatchAccount) |
self.assertEqual(updated.tags['Name'], 'tagName') |
self.assertEqual(updated.tags['Value'], 'tagValue') |
self.mgmt_batch_client.batch_account.delete(resource_group.name, account_name) |
self.assertIsNone(response.result() |
ResourceGroupPreparer(location=AZURE_LOCATION) |
StorageAccountPreparer(name_prefix='batch', location=AZURE_LOCATION) |
test_mgmt_batch_applications(self, resource_group, location, storage_account, storage_account_key) |
models.AutoStorageBaseProperties(storage_resource) |
self._get_account_name() |
account_setup.result() |
self.assertIsNone(response) |
models.Application(display_name=application_name, allow_updates=True) |
self.assertIsInstance(application, models.Application) |
self.assertTrue(application_id in application.id) |
self.assertTrue(application_name in application.display_name) |
self.assertTrue(application.allow_updates) |
self.mgmt_batch_client.application.get(resource_group.name, account_name, application_id) |
self.assertIsInstance(application, models.Application) |
self.assertTrue(application_id in application.id) |
self.assertTrue(application_name in application.display_name) |
self.assertTrue(application.allow_updates) |
self.mgmt_batch_client.application.list(resource_group.name, account_name) |
self.assertTrue(len(list(applications) |
self.assertIsInstance(package_ref, models.ApplicationPackage) |
io.BytesIO(b'Hello World') |
requests.put(package_ref.storage_url, headers=headers, data=f.read() |
ValueError('Upload failed: {!r}'.format(upload) |
self.assertTrue(response.state == models.PackageState.active) |
self.assertTrue(application_ver in response.default_version) |
self.assertTrue('my_updated_name' in response.display_name) |
self.assertFalse(response.allow_updates) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.