mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 17:22:29 -05:00
Load profile support for sql project deploy (#10948)
* load database name from profile.xml * load sqlcmd variables from profile * Add warning text * add tests * fix file filter for windows * add comments * show SQLCMD variables in a table * reset dialog before testing readPublishProfile callback
This commit is contained in:
@@ -117,6 +117,7 @@ describe.skip('ProjectsController: project controller operations', function ():
|
||||
|
||||
const deployHoller = 'hello from callback for deploy()';
|
||||
const generateHoller = 'hello from callback for generateScript()';
|
||||
const profileHoller = 'hello from callback for readPublishProfile()';
|
||||
|
||||
let holler = 'nothing';
|
||||
|
||||
@@ -131,6 +132,13 @@ describe.skip('ProjectsController: project controller operations', function ():
|
||||
holler = deployHoller;
|
||||
return undefined;
|
||||
});
|
||||
projController.setup(x => x.readPublishProfile(TypeMoq.It.isAny())).returns(async () => {
|
||||
holler = profileHoller;
|
||||
return {
|
||||
databaseName: '',
|
||||
sqlCmdVariables: {}
|
||||
};
|
||||
});
|
||||
|
||||
projController.setup(x => x.executionCallback(TypeMoq.It.isAny(), TypeMoq.It.is((_): _ is IGenerateScriptProfile => true))).returns(async () => {
|
||||
holler = generateHoller;
|
||||
@@ -146,6 +154,22 @@ describe.skip('ProjectsController: project controller operations', function ():
|
||||
await dialog.generateScriptClick();
|
||||
|
||||
should(holler).equal(generateHoller, 'executionCallback() is supposed to have been setup and called for GenerateScript scenario');
|
||||
|
||||
dialog = await projController.object.deployProject(proj);
|
||||
await projController.object.readPublishProfile(vscode.Uri.parse('test'));
|
||||
|
||||
should(holler).equal(profileHoller, 'executionCallback() is supposed to have been setup and called for ReadPublishProfile scenario');
|
||||
});
|
||||
|
||||
it('Should read database name and SQLCMD variables from publish profile', async function (): Promise<void> {
|
||||
await baselines.loadBaselines();
|
||||
let profilePath = await testUtils.createTestFile(baselines.publishProfileBaseline, 'publishProfile.publish.xml');
|
||||
const projController = new ProjectsController(testContext.apiWrapper.object, new SqlDatabaseProjectTreeViewProvider());
|
||||
|
||||
let result = await projController.readPublishProfile(vscode.Uri.parse(profilePath));
|
||||
should(result.databaseName).equal('targetDb');
|
||||
should(Object.keys(result.sqlCmdVariables).length).equal(1);
|
||||
should(result.sqlCmdVariables['ProdDatabaseName']).equal('MyProdDatabase');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user