mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
cleanup dacpac and schema compare to use createConnectionProfile() from ads-test (#19942)
* cleanup dacpac and schema compare to use createConnectionProfile() from ads-test * typo * reuse mockConnectionInfo
This commit is contained in:
@@ -20,12 +20,12 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/Microsoft/azuredatastudio.git"
|
"url": "https://github.com/Microsoft/azuredatastudio.git"
|
||||||
},
|
},
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"virtualWorkspaces": false,
|
"virtualWorkspaces": false,
|
||||||
"untrustedWorkspaces": {
|
"untrustedWorkspaces": {
|
||||||
"supported": true
|
"supported": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extensionDependencies": [
|
"extensionDependencies": [
|
||||||
"Microsoft.mssql"
|
"Microsoft.mssql"
|
||||||
],
|
],
|
||||||
@@ -97,6 +97,8 @@
|
|||||||
"vscode-nls": "^4.0.0"
|
"vscode-nls": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@microsoft/azdata-test": "^1.5.2",
|
||||||
|
"@microsoft/vscodetestcover": "^1.2.1",
|
||||||
"@types/mocha": "^7.0.2",
|
"@types/mocha": "^7.0.2",
|
||||||
"@types/node": "^12.11.7",
|
"@types/node": "^12.11.7",
|
||||||
"@types/sinon": "^9.0.4",
|
"@types/sinon": "^9.0.4",
|
||||||
@@ -105,8 +107,7 @@
|
|||||||
"mocha-multi-reporters": "^1.1.7",
|
"mocha-multi-reporters": "^1.1.7",
|
||||||
"should": "^13.2.3",
|
"should": "^13.2.3",
|
||||||
"sinon": "^9.0.2",
|
"sinon": "^9.0.2",
|
||||||
"typemoq": "^2.1.0",
|
"typemoq": "^2.1.0"
|
||||||
"@microsoft/vscodetestcover": "^1.2.1"
|
|
||||||
},
|
},
|
||||||
"__metadata": {
|
"__metadata": {
|
||||||
"id": "33",
|
"id": "33",
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ import * as azdata from 'azdata';
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import * as azdataTest from '@microsoft/azdata-test';
|
||||||
|
|
||||||
import { DataTierApplicationWizard, PageName } from '../wizard/dataTierApplicationWizard';
|
import { DataTierApplicationWizard, PageName } from '../wizard/dataTierApplicationWizard';
|
||||||
import { DacFxDataModel } from '../wizard/api/models';
|
import { DacFxDataModel } from '../wizard/api/models';
|
||||||
import { TestContext, createContext } from './testContext';
|
import { TestContext, createContext } from './testContext';
|
||||||
import { TestDeployConfigPage, TestExtractConfigPage, TestImportConfigPage } from './testDacFxConfigPages';
|
import { TestDeployConfigPage, TestExtractConfigPage, TestImportConfigPage } from './testDacFxConfigPages';
|
||||||
import { mockConnectionProfile } from './testUtils';
|
|
||||||
|
|
||||||
let wizard: DataTierApplicationWizard;
|
let wizard: DataTierApplicationWizard;
|
||||||
let testContext: TestContext;
|
let testContext: TestContext;
|
||||||
@@ -92,7 +92,7 @@ describe('Dacfx Wizard Pages', function (): void {
|
|||||||
testContext = createContext();
|
testContext = createContext();
|
||||||
wizard.setPages();
|
wizard.setPages();
|
||||||
|
|
||||||
sinon.stub(azdata.connection, 'getConnections').resolves([mockConnectionProfile]);
|
sinon.stub(azdata.connection, 'getConnections').resolves([azdataTest.stubs.connectionProfile.createConnectionProfile()]);
|
||||||
sinon.stub(azdata.connection, 'listDatabases').resolves(['fakeDatabaseName']);
|
sinon.stub(azdata.connection, 'listDatabases').resolves(['fakeDatabaseName']);
|
||||||
sinon.stub(vscode.window, 'showOpenDialog').resolves([vscode.Uri.file(dacpacPath)]);
|
sinon.stub(vscode.window, 'showOpenDialog').resolves([vscode.Uri.file(dacpacPath)]);
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ describe('Dacfx Wizard Pages', function (): void {
|
|||||||
testContext = createContext();
|
testContext = createContext();
|
||||||
wizard.setPages();
|
wizard.setPages();
|
||||||
|
|
||||||
sinon.stub(azdata.connection, 'getConnections').resolves([mockConnectionProfile]);
|
sinon.stub(azdata.connection, 'getConnections').resolves([azdataTest.stubs.connectionProfile.createConnectionProfile()]);
|
||||||
sinon.stub(azdata.connection, 'listDatabases').resolves(['fakeDatabaseName', 'master', 'msdb', 'tempdb', 'model']);
|
sinon.stub(azdata.connection, 'listDatabases').resolves(['fakeDatabaseName', 'master', 'msdb', 'tempdb', 'model']);
|
||||||
|
|
||||||
let extractConfigPage = new TestExtractConfigPage(wizard, wizard.pages.get(PageName.deployConfig).wizardPage, wizard.model, testContext.viewContext.view);
|
let extractConfigPage = new TestExtractConfigPage(wizard, wizard.pages.get(PageName.deployConfig).wizardPage, wizard.model, testContext.viewContext.view);
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
|
||||||
|
|
||||||
export const mockConnectionProfile: azdata.connection.ConnectionProfile = {
|
|
||||||
providerId: 'MSSQL',
|
|
||||||
connectionId: 'My Connection ID',
|
|
||||||
connectionName: 'My Connection',
|
|
||||||
serverName: 'My Server',
|
|
||||||
databaseName: 'My Database',
|
|
||||||
userName: 'My User',
|
|
||||||
password: 'My Pwd',
|
|
||||||
authenticationType: 'SqlLogin',
|
|
||||||
savePassword: false,
|
|
||||||
groupFullName: 'My groupName',
|
|
||||||
groupId: 'My GroupId',
|
|
||||||
saveProfile: true,
|
|
||||||
options: {}
|
|
||||||
};
|
|
||||||
@@ -220,6 +220,16 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-shims/-/applicationinsights-shims-2.0.1.tgz#5d72fb7aaf4056c4fda54f9d7c93ccf8ca9bcbfd"
|
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-shims/-/applicationinsights-shims-2.0.1.tgz#5d72fb7aaf4056c4fda54f9d7c93ccf8ca9bcbfd"
|
||||||
integrity sha512-G0MXf6R6HndRbDy9BbEj0zrLeuhwt2nsXk2zKtF0TnYo39KgYqhYC2ayIzKPTm2KAE+xzD7rgyLdZnrcRvt9WQ==
|
integrity sha512-G0MXf6R6HndRbDy9BbEj0zrLeuhwt2nsXk2zKtF0TnYo39KgYqhYC2ayIzKPTm2KAE+xzD7rgyLdZnrcRvt9WQ==
|
||||||
|
|
||||||
|
"@microsoft/azdata-test@^1.5.2":
|
||||||
|
version "1.5.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@microsoft/azdata-test/-/azdata-test-1.5.2.tgz#0a750eed6c686eaf98e63db580f119916a083d6a"
|
||||||
|
integrity sha512-m1WVNxkCqU8nkaRB0Q/DEq1wHej0Ev3bfyEmsPgX9znymY7MD9c1l6kRoHtPPmsYYDEjcCxO2QXUJAsNUeAKwg==
|
||||||
|
dependencies:
|
||||||
|
http-proxy-agent "^2.1.0"
|
||||||
|
https-proxy-agent "^2.2.4"
|
||||||
|
rimraf "^2.6.3"
|
||||||
|
typemoq "^2.1.0"
|
||||||
|
|
||||||
"@microsoft/dynamicproto-js@^1.1.6":
|
"@microsoft/dynamicproto-js@^1.1.6":
|
||||||
version "1.1.6"
|
version "1.1.6"
|
||||||
resolved "https://registry.yarnpkg.com/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.6.tgz#6fe03468862861f5f88ac4c3959a652b3797f1bc"
|
resolved "https://registry.yarnpkg.com/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.6.tgz#6fe03468862861f5f88ac4c3959a652b3797f1bc"
|
||||||
@@ -306,6 +316,13 @@
|
|||||||
"@microsoft/1ds-core-js" "^3.2.3"
|
"@microsoft/1ds-core-js" "^3.2.3"
|
||||||
"@microsoft/1ds-post-js" "^3.2.3"
|
"@microsoft/1ds-post-js" "^3.2.3"
|
||||||
|
|
||||||
|
agent-base@4, agent-base@^4.3.0:
|
||||||
|
version "4.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
|
||||||
|
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
|
||||||
|
dependencies:
|
||||||
|
es6-promisify "^5.0.0"
|
||||||
|
|
||||||
ansi-colors@3.2.3:
|
ansi-colors@3.2.3:
|
||||||
version "3.2.3"
|
version "3.2.3"
|
||||||
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813"
|
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813"
|
||||||
@@ -470,6 +487,13 @@ crypt@~0.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
|
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
|
||||||
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=
|
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=
|
||||||
|
|
||||||
|
debug@3.1.0:
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
|
||||||
|
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
|
||||||
|
dependencies:
|
||||||
|
ms "2.0.0"
|
||||||
|
|
||||||
debug@3.2.6, debug@^3.1.0:
|
debug@3.2.6, debug@^3.1.0:
|
||||||
version "3.2.6"
|
version "3.2.6"
|
||||||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
|
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
|
||||||
@@ -604,6 +628,18 @@ es-to-primitive@^1.2.1:
|
|||||||
is-date-object "^1.0.1"
|
is-date-object "^1.0.1"
|
||||||
is-symbol "^1.0.2"
|
is-symbol "^1.0.2"
|
||||||
|
|
||||||
|
es6-promise@^4.0.3:
|
||||||
|
version "4.2.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
|
||||||
|
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==
|
||||||
|
|
||||||
|
es6-promisify@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
|
||||||
|
integrity sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==
|
||||||
|
dependencies:
|
||||||
|
es6-promise "^4.0.3"
|
||||||
|
|
||||||
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5:
|
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5:
|
||||||
version "1.0.5"
|
version "1.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||||
@@ -808,6 +844,22 @@ htmlparser2@^3.10.1:
|
|||||||
inherits "^2.0.1"
|
inherits "^2.0.1"
|
||||||
readable-stream "^3.1.1"
|
readable-stream "^3.1.1"
|
||||||
|
|
||||||
|
http-proxy-agent@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405"
|
||||||
|
integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==
|
||||||
|
dependencies:
|
||||||
|
agent-base "4"
|
||||||
|
debug "3.1.0"
|
||||||
|
|
||||||
|
https-proxy-agent@^2.2.4:
|
||||||
|
version "2.2.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b"
|
||||||
|
integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==
|
||||||
|
dependencies:
|
||||||
|
agent-base "^4.3.0"
|
||||||
|
debug "^3.1.0"
|
||||||
|
|
||||||
inflight@^1.0.4:
|
inflight@^1.0.4:
|
||||||
version "1.0.6"
|
version "1.0.6"
|
||||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||||
|
|||||||
@@ -100,16 +100,17 @@
|
|||||||
"vscode-nls": "^4.0.0"
|
"vscode-nls": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@microsoft/azdata-test": "^1.5.2",
|
||||||
|
"@microsoft/vscodetestcover": "^1.2.1",
|
||||||
"@types/mocha": "^7.0.2",
|
"@types/mocha": "^7.0.2",
|
||||||
"@types/sinon": "^9.0.4",
|
|
||||||
"@types/node": "^12.11.7",
|
"@types/node": "^12.11.7",
|
||||||
|
"@types/sinon": "^9.0.4",
|
||||||
"mocha": "^7.1.1",
|
"mocha": "^7.1.1",
|
||||||
"mocha-junit-reporter": "^1.17.0",
|
"mocha-junit-reporter": "^1.17.0",
|
||||||
"mocha-multi-reporters": "^1.1.7",
|
"mocha-multi-reporters": "^1.1.7",
|
||||||
"should": "^13.2.1",
|
"should": "^13.2.1",
|
||||||
"typemoq": "^2.1.0",
|
"sinon": "^9.0.2",
|
||||||
"@microsoft/vscodetestcover": "^1.2.1",
|
"typemoq": "^2.1.0"
|
||||||
"sinon": "^9.0.2"
|
|
||||||
},
|
},
|
||||||
"__metadata": {
|
"__metadata": {
|
||||||
"id": "37",
|
"id": "37",
|
||||||
|
|||||||
@@ -9,11 +9,13 @@ import * as TypeMoq from 'typemoq';
|
|||||||
import * as loc from '../localizedConstants';
|
import * as loc from '../localizedConstants';
|
||||||
import * as sinon from 'sinon';
|
import * as sinon from 'sinon';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
|
import * as azdataTest from '@microsoft/azdata-test';
|
||||||
|
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
import { ConnectionDropdownValue, SchemaCompareDialog } from './../dialogs/schemaCompareDialog';
|
import { ConnectionDropdownValue, SchemaCompareDialog } from './../dialogs/schemaCompareDialog';
|
||||||
import { SchemaCompareMainWindow } from '../schemaCompareMainWindow';
|
import { SchemaCompareMainWindow } from '../schemaCompareMainWindow';
|
||||||
import { createContext, TestContext } from './testContext';
|
import { createContext, TestContext } from './testContext';
|
||||||
import { mockConnectionProfile, mockConnectionProfile2, setDacpacEndpointInfo } from './testUtils';
|
import { setDacpacEndpointInfo } from './testUtils';
|
||||||
import { SchemaCompareMainWindowTest } from './testSchemaCompareMainWindow';
|
import { SchemaCompareMainWindowTest } from './testSchemaCompareMainWindow';
|
||||||
import { SchemaCompareDialogTest } from './testSchemaCompareDialog';
|
import { SchemaCompareDialogTest } from './testSchemaCompareDialog';
|
||||||
|
|
||||||
@@ -75,9 +77,10 @@ describe('SchemaCompareDialog.openDialog @DacFx@', function (): void {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Verify server dropdown gets populated appropriately', async function (): Promise<void> {
|
it('Verify server dropdown gets populated appropriately', async function (): Promise<void> {
|
||||||
const getConnectionsResults: azdata.connection.ConnectionProfile[] = [{ ...mockConnectionProfile }];
|
const connectionProfile = azdataTest.stubs.connectionProfile.createConnectionProfile();
|
||||||
|
const getConnectionsResults: azdata.connection.ConnectionProfile[] = [{ ...connectionProfile }];
|
||||||
sinon.stub(azdata.connection, 'getCurrentConnection').resolves(undefined);
|
sinon.stub(azdata.connection, 'getCurrentConnection').resolves(undefined);
|
||||||
sinon.stub(azdata.connection, 'openConnectionDialog').resolves(<any>Promise.resolve(mockConnectionProfile));
|
sinon.stub(azdata.connection, 'openConnectionDialog').resolves(<any>Promise.resolve(connectionProfile));
|
||||||
sinon.stub(azdata.connection, 'getConnections').resolves(<any>Promise.resolve(getConnectionsResults));
|
sinon.stub(azdata.connection, 'getConnections').resolves(<any>Promise.resolve(getConnectionsResults));
|
||||||
sinon.stub(azdata.connection, 'listDatabases').resolves(['My Database']);
|
sinon.stub(azdata.connection, 'listDatabases').resolves(['My Database']);
|
||||||
|
|
||||||
@@ -95,17 +98,20 @@ describe('SchemaCompareDialog.openDialog @DacFx@', function (): void {
|
|||||||
|
|
||||||
// Confirm source server dropdown has the new connection as its value
|
// Confirm source server dropdown has the new connection as its value
|
||||||
should.notEqual(dialog.getSourceServerDropdownValue(), undefined);
|
should.notEqual(dialog.getSourceServerDropdownValue(), undefined);
|
||||||
should((dialog.getSourceServerDropdownValue() as ConnectionDropdownValue).connection).deepEqual(mockConnectionProfile, `SourceDropdownValue: (Actual) ${(dialog.getSourceServerDropdownValue() as ConnectionDropdownValue).connection} (Expected) ${mockConnectionProfile}`);
|
should((dialog.getSourceServerDropdownValue() as ConnectionDropdownValue).connection).deepEqual(connectionProfile, `SourceDropdownValue: (Actual) ${(dialog.getSourceServerDropdownValue() as ConnectionDropdownValue).connection} (Expected) ${connectionProfile}`);
|
||||||
|
|
||||||
// Target server dropdown passively populated with the new connection, since it wasn't pre-populated
|
// Target server dropdown passively populated with the new connection, since it wasn't pre-populated
|
||||||
should.notEqual(dialog.getTargetServerDropdownValue(), undefined);
|
should.notEqual(dialog.getTargetServerDropdownValue(), undefined);
|
||||||
should((dialog.getTargetServerDropdownValue() as ConnectionDropdownValue).connection).deepEqual(mockConnectionProfile, `TargetDropdownValue: (Actual) ${(dialog.getTargetServerDropdownValue() as ConnectionDropdownValue).connection} (Expected) ${mockConnectionProfile}`);
|
should((dialog.getTargetServerDropdownValue() as ConnectionDropdownValue).connection).deepEqual(connectionProfile, `TargetDropdownValue: (Actual) ${(dialog.getTargetServerDropdownValue() as ConnectionDropdownValue).connection} (Expected) ${connectionProfile}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Verify source server dropdown does not get updated when target server is updated', async function (): Promise<void> {
|
it('Verify source server dropdown does not get updated when target server is updated', async function (): Promise<void> {
|
||||||
sinon.stub(azdata.connection, 'getCurrentConnection').resolves({ ...mockConnectionProfile });
|
const connectionProfile1 = azdataTest.stubs.connectionProfile.createConnectionProfile({ connectionName: 'connection1', connectionId: 'testId1', databaseName: 'db1'});
|
||||||
sinon.stub(azdata.connection, 'openConnectionDialog').resolves(<any>Promise.resolve(mockConnectionProfile2));
|
const connectionProfile2 = azdataTest.stubs.connectionProfile.createConnectionProfile({ connectionName: 'connection2', connectionId: 'testId2', databaseName: 'db2'});
|
||||||
sinon.stub(azdata.connection, 'getConnections').resolves(<any>Promise.resolve([{ ...mockConnectionProfile }, { ...mockConnectionProfile2 }]));
|
|
||||||
|
sinon.stub(azdata.connection, 'getCurrentConnection').resolves({ ...connectionProfile1 });
|
||||||
|
sinon.stub(azdata.connection, 'openConnectionDialog').resolves(<any>Promise.resolve(connectionProfile2));
|
||||||
|
sinon.stub(azdata.connection, 'getConnections').resolves(<any>Promise.resolve([{ ...connectionProfile1 }, { ...connectionProfile2 }]));
|
||||||
sinon.stub(azdata.connection, 'listDatabases').resolves(['My Database']);
|
sinon.stub(azdata.connection, 'listDatabases').resolves(['My Database']);
|
||||||
|
|
||||||
let schemaCompareResult = new SchemaCompareMainWindow(undefined, mockExtensionContext.object);
|
let schemaCompareResult = new SchemaCompareMainWindow(undefined, mockExtensionContext.object);
|
||||||
@@ -122,10 +128,10 @@ describe('SchemaCompareDialog.openDialog @DacFx@', function (): void {
|
|||||||
|
|
||||||
// Confirm source server dropdown has the current connection (from getCurrentConnection) as its value (and doesn't get updated to what target server is)
|
// Confirm source server dropdown has the current connection (from getCurrentConnection) as its value (and doesn't get updated to what target server is)
|
||||||
should.notEqual(dialog.getSourceServerDropdownValue(), undefined);
|
should.notEqual(dialog.getSourceServerDropdownValue(), undefined);
|
||||||
should((dialog.getSourceServerDropdownValue() as ConnectionDropdownValue).connection).deepEqual(mockConnectionProfile, `SourceDropdownValue: (Actual) ${(dialog.getSourceServerDropdownValue() as ConnectionDropdownValue).connection} (Expected) ${mockConnectionProfile}`);
|
should((dialog.getSourceServerDropdownValue() as ConnectionDropdownValue).connection).deepEqual(connectionProfile1, `SourceDropdownValue: (Actual) ${(dialog.getSourceServerDropdownValue() as ConnectionDropdownValue).connection} (Expected) ${connectionProfile1}`);
|
||||||
|
|
||||||
// Confirm target server dropdown has the new connection (from openConnectionDialog) as its value
|
// Confirm target server dropdown has the new connection (from openConnectionDialog) as its value
|
||||||
should.notEqual(dialog.getTargetServerDropdownValue(), undefined);
|
should.notEqual(dialog.getTargetServerDropdownValue(), undefined);
|
||||||
should((dialog.getTargetServerDropdownValue() as ConnectionDropdownValue).connection).deepEqual(mockConnectionProfile2, `TargetDropdownValue: (Actual) ${(dialog.getTargetServerDropdownValue() as ConnectionDropdownValue).connection} (Expected) ${mockConnectionProfile2}`);
|
should((dialog.getTargetServerDropdownValue() as ConnectionDropdownValue).connection).deepEqual(connectionProfile2, `TargetDropdownValue: (Actual) ${(dialog.getTargetServerDropdownValue() as ConnectionDropdownValue).connection} (Expected) ${connectionProfile2}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,50 +25,6 @@ export const mockIConnectionProfile: azdata.IConnectionProfile = {
|
|||||||
options: null
|
options: null
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mockConnectionProfile: azdata.connection.ConnectionProfile = {
|
|
||||||
providerId: 'My Provider',
|
|
||||||
connectionId: 'My Id',
|
|
||||||
connectionName: 'My Connection',
|
|
||||||
serverName: 'My Server',
|
|
||||||
databaseName: 'My Database',
|
|
||||||
userName: 'My User',
|
|
||||||
password: 'My Pwd',
|
|
||||||
authenticationType: 'SqlLogin',
|
|
||||||
savePassword: false,
|
|
||||||
groupFullName: 'My groupName',
|
|
||||||
groupId: 'My GroupId',
|
|
||||||
saveProfile: true,
|
|
||||||
options: {
|
|
||||||
server: 'My Server',
|
|
||||||
database: 'My Database',
|
|
||||||
user: 'My User',
|
|
||||||
password: 'My Pwd',
|
|
||||||
authenticationType: 'SqlLogin'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const mockConnectionProfile2: azdata.connection.ConnectionProfile = {
|
|
||||||
providerId: 'My Provider2',
|
|
||||||
connectionId: 'My Id2',
|
|
||||||
connectionName: 'My Connection2',
|
|
||||||
serverName: 'My Server2',
|
|
||||||
databaseName: 'My Database2',
|
|
||||||
userName: 'My User2',
|
|
||||||
password: 'My Pwd2',
|
|
||||||
authenticationType: 'SqlLogin',
|
|
||||||
savePassword: false,
|
|
||||||
groupFullName: 'My groupName2',
|
|
||||||
groupId: 'My GroupId2',
|
|
||||||
saveProfile: true,
|
|
||||||
options: {
|
|
||||||
server: 'My Server2',
|
|
||||||
database: 'My Database2',
|
|
||||||
user: 'My User2',
|
|
||||||
password: 'My Pwd2',
|
|
||||||
authenticationType: 'SqlLogin'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const mockConnectionResult: azdata.ConnectionResult = {
|
export const mockConnectionResult: azdata.ConnectionResult = {
|
||||||
connected: false,
|
connected: false,
|
||||||
connectionId: undefined,
|
connectionId: undefined,
|
||||||
|
|||||||
@@ -8,13 +8,14 @@ import * as azdata from 'azdata';
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as mssql from 'mssql';
|
import * as mssql from 'mssql';
|
||||||
import * as loc from '../localizedConstants';
|
import * as loc from '../localizedConstants';
|
||||||
import * as TypeMoq from 'typemoq';
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as uuid from 'uuid';
|
import * as uuid from 'uuid';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
|
import * as azdataTest from '@microsoft/azdata-test';
|
||||||
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import { getEndpointName, verifyConnectionAndGetOwnerUri, exists } from '../utils';
|
import { getEndpointName, verifyConnectionAndGetOwnerUri, exists } from '../utils';
|
||||||
import { mockDacpacEndpoint, mockDatabaseEndpoint, mockFilePath, mockConnectionInfo, shouldThrowSpecificError, mockConnectionResult, mockConnectionProfile } from './testUtils';
|
import { mockDacpacEndpoint, mockDatabaseEndpoint, mockFilePath, mockConnectionInfo, shouldThrowSpecificError, mockConnectionResult } from './testUtils';
|
||||||
import { createContext, TestContext } from './testContext';
|
import { createContext, TestContext } from './testContext';
|
||||||
import * as sinon from 'sinon';
|
import * as sinon from 'sinon';
|
||||||
|
|
||||||
@@ -115,7 +116,16 @@ describe('utils: In-depth tests to verify verifyConnectionAndGetOwnerUri', funct
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Should throw an error for login failure', async function (): Promise<void> {
|
it('Should throw an error for login failure', async function (): Promise<void> {
|
||||||
const getConnectionsResults: azdata.connection.ConnectionProfile[] = [{ ...mockConnectionProfile }];
|
const connectionProfile = azdataTest.stubs.connectionProfile.createConnectionProfile({
|
||||||
|
// these need to match what's in mockConnectionInfo in testUtils.ts
|
||||||
|
options: {
|
||||||
|
server: mockConnectionInfo.serverName,
|
||||||
|
database: mockConnectionInfo.databaseName,
|
||||||
|
user: mockConnectionInfo.userName,
|
||||||
|
authenticationType: mockConnectionInfo.authenticationType
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const getConnectionsResults: azdata.connection.ConnectionProfile[] = [{ ...connectionProfile }];
|
||||||
const connection = { ...mockConnectionResult };
|
const connection = { ...mockConnectionResult };
|
||||||
const testDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = { ...mockDatabaseEndpoint };
|
const testDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = { ...mockDatabaseEndpoint };
|
||||||
testDatabaseEndpoint.connectionDetails = { ...mockConnectionInfo };
|
testDatabaseEndpoint.connectionDetails = { ...mockConnectionInfo };
|
||||||
|
|||||||
@@ -220,6 +220,16 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-shims/-/applicationinsights-shims-2.0.1.tgz#5d72fb7aaf4056c4fda54f9d7c93ccf8ca9bcbfd"
|
resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-shims/-/applicationinsights-shims-2.0.1.tgz#5d72fb7aaf4056c4fda54f9d7c93ccf8ca9bcbfd"
|
||||||
integrity sha512-G0MXf6R6HndRbDy9BbEj0zrLeuhwt2nsXk2zKtF0TnYo39KgYqhYC2ayIzKPTm2KAE+xzD7rgyLdZnrcRvt9WQ==
|
integrity sha512-G0MXf6R6HndRbDy9BbEj0zrLeuhwt2nsXk2zKtF0TnYo39KgYqhYC2ayIzKPTm2KAE+xzD7rgyLdZnrcRvt9WQ==
|
||||||
|
|
||||||
|
"@microsoft/azdata-test@^1.5.2":
|
||||||
|
version "1.5.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@microsoft/azdata-test/-/azdata-test-1.5.2.tgz#0a750eed6c686eaf98e63db580f119916a083d6a"
|
||||||
|
integrity sha512-m1WVNxkCqU8nkaRB0Q/DEq1wHej0Ev3bfyEmsPgX9znymY7MD9c1l6kRoHtPPmsYYDEjcCxO2QXUJAsNUeAKwg==
|
||||||
|
dependencies:
|
||||||
|
http-proxy-agent "^2.1.0"
|
||||||
|
https-proxy-agent "^2.2.4"
|
||||||
|
rimraf "^2.6.3"
|
||||||
|
typemoq "^2.1.0"
|
||||||
|
|
||||||
"@microsoft/dynamicproto-js@^1.1.6":
|
"@microsoft/dynamicproto-js@^1.1.6":
|
||||||
version "1.1.6"
|
version "1.1.6"
|
||||||
resolved "https://registry.yarnpkg.com/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.6.tgz#6fe03468862861f5f88ac4c3959a652b3797f1bc"
|
resolved "https://registry.yarnpkg.com/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.6.tgz#6fe03468862861f5f88ac4c3959a652b3797f1bc"
|
||||||
@@ -306,6 +316,13 @@
|
|||||||
"@microsoft/1ds-core-js" "^3.2.3"
|
"@microsoft/1ds-core-js" "^3.2.3"
|
||||||
"@microsoft/1ds-post-js" "^3.2.3"
|
"@microsoft/1ds-post-js" "^3.2.3"
|
||||||
|
|
||||||
|
agent-base@4, agent-base@^4.3.0:
|
||||||
|
version "4.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
|
||||||
|
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
|
||||||
|
dependencies:
|
||||||
|
es6-promisify "^5.0.0"
|
||||||
|
|
||||||
ansi-colors@3.2.3:
|
ansi-colors@3.2.3:
|
||||||
version "3.2.3"
|
version "3.2.3"
|
||||||
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813"
|
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813"
|
||||||
@@ -470,6 +487,13 @@ crypt@~0.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
|
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
|
||||||
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=
|
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=
|
||||||
|
|
||||||
|
debug@3.1.0:
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
|
||||||
|
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
|
||||||
|
dependencies:
|
||||||
|
ms "2.0.0"
|
||||||
|
|
||||||
debug@3.2.6, debug@^3.1.0:
|
debug@3.2.6, debug@^3.1.0:
|
||||||
version "3.2.6"
|
version "3.2.6"
|
||||||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
|
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
|
||||||
@@ -571,6 +595,18 @@ es-to-primitive@^1.2.1:
|
|||||||
is-date-object "^1.0.1"
|
is-date-object "^1.0.1"
|
||||||
is-symbol "^1.0.2"
|
is-symbol "^1.0.2"
|
||||||
|
|
||||||
|
es6-promise@^4.0.3:
|
||||||
|
version "4.2.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
|
||||||
|
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==
|
||||||
|
|
||||||
|
es6-promisify@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
|
||||||
|
integrity sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==
|
||||||
|
dependencies:
|
||||||
|
es6-promise "^4.0.3"
|
||||||
|
|
||||||
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5:
|
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5:
|
||||||
version "1.0.5"
|
version "1.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||||
@@ -763,6 +799,22 @@ html-escaper@^2.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453"
|
resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453"
|
||||||
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==
|
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==
|
||||||
|
|
||||||
|
http-proxy-agent@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405"
|
||||||
|
integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==
|
||||||
|
dependencies:
|
||||||
|
agent-base "4"
|
||||||
|
debug "3.1.0"
|
||||||
|
|
||||||
|
https-proxy-agent@^2.2.4:
|
||||||
|
version "2.2.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b"
|
||||||
|
integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==
|
||||||
|
dependencies:
|
||||||
|
agent-base "^4.3.0"
|
||||||
|
debug "^3.1.0"
|
||||||
|
|
||||||
inflight@^1.0.4:
|
inflight@^1.0.4:
|
||||||
version "1.0.6"
|
version "1.0.6"
|
||||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||||
|
|||||||
Reference in New Issue
Block a user