* Delete account

* Update code according to comments
This commit is contained in:
v-wuzhai 2020-01-22 20:37:47 -08:00 коммит произвёл GitHub
Родитель 9a293eab09
Коммит 831536c561
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -80,7 +80,7 @@ suite('MongoDB action', async function (this: ISuiteCallbackContext): Promise<vo
assert.ifError(mongoDatabase); assert.ifError(mongoDatabase);
}); });
test('Delete account', async () => { test('Delete Mongo account', async () => {
const mongoAccount: CosmosDBManagementModels.DatabaseAccount = await client.databaseAccounts.get(resourceGroupName, accountName); const mongoAccount: CosmosDBManagementModels.DatabaseAccount = await client.databaseAccounts.get(resourceGroupName, accountName);
assert.ok(mongoAccount); assert.ok(mongoAccount);
const testInputs: string[] = [`${accountName} (MongoDB)`, DialogResponses.deleteResponse.title]; const testInputs: string[] = [`${accountName} (MongoDB)`, DialogResponses.deleteResponse.title];

Просмотреть файл

@ -7,7 +7,7 @@ import * as assert from 'assert';
import { CosmosDBManagementModels } from 'azure-arm-cosmosdb'; import { CosmosDBManagementModels } from 'azure-arm-cosmosdb';
import { IHookCallbackContext, ISuiteCallbackContext } from 'mocha'; import { IHookCallbackContext, ISuiteCallbackContext } from 'mocha';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { randomUtils } from '../../extension.bundle'; import { randomUtils, DialogResponses } from '../../extension.bundle';
import { longRunningTestsEnabled, testUserInput } from '../global.test'; import { longRunningTestsEnabled, testUserInput } from '../global.test';
import { resourceGroupsToDelete, client } from './global.resource.test'; import { resourceGroupsToDelete, client } from './global.resource.test';
@ -35,4 +35,16 @@ suite('SQL action', async function (this: ISuiteCallbackContext): Promise<void>
const getAccount: CosmosDBManagementModels.DatabaseAccount | undefined = await client.databaseAccounts.get(resourceGroupName, accountName); const getAccount: CosmosDBManagementModels.DatabaseAccount | undefined = await client.databaseAccounts.get(resourceGroupName, accountName);
assert.ok(getAccount); assert.ok(getAccount);
}); });
test('Delete SQL account', async () => {
const SQLAccount: CosmosDBManagementModels.DatabaseAccount = await client.databaseAccounts.get(resourceGroupName, accountName);
assert.ok(SQLAccount);
const testInputs: string[] = [`${accountName} (SQL)`, DialogResponses.deleteResponse.title];
await testUserInput.runWithInputs(testInputs, async () => {
await vscode.commands.executeCommand('cosmosDB.deleteAccount');
});
const listAccounts: CosmosDBManagementModels.DatabaseAccountsListResult = await client.databaseAccounts.listByResourceGroup(resourceGroupName);
const accountExists: CosmosDBManagementModels.DatabaseAccount | undefined = listAccounts.find((account: CosmosDBManagementModels.DatabaseAccount) => account.name === accountName);
assert.ifError(accountExists);
});
}); });