Make 'Script to notebook' consistent with 'Deploy' when user cancels during password re-acquisition for controller (#13557)

This commit is contained in:
Arvind Ranasaria
2020-12-01 22:57:00 -08:00
committed by GitHub
parent 1078d67728
commit 8027993ab4
11 changed files with 48 additions and 16 deletions

View File

@@ -11,7 +11,8 @@ import * as sinon from 'sinon';
import * as TypeMoq from 'typemoq';
import { v4 as uuid } from 'uuid';
import * as vscode from 'vscode';
import { UserCancelledError } from '../../common/utils';
import * as loc from '../../localizedConstants';
import { UserCancelledError } from '../../common/api';
import { ControllerModel } from '../../models/controllerModel';
import { ConnectToControllerDialog } from '../../ui/dialogs/connectControllerDialog';
import { AzureArcTreeDataProvider } from '../../ui/tree/azureArcTreeDataProvider';
@@ -39,7 +40,7 @@ describe('ControllerModel', function (): void {
// Returning an undefined model here indicates that the dialog closed without clicking "Ok" - usually through the user clicking "Cancel"
sinon.stub(ConnectToControllerDialog.prototype, 'waitForClose').returns(Promise.resolve(undefined));
const model = new ControllerModel(new AzureArcTreeDataProvider(mockExtensionContext.object), { id: uuid(), url: '127.0.0.1', username: 'admin', name: 'arc', rememberPassword: true, resources: [] });
await should(model.azdataLogin()).be.rejectedWith(new UserCancelledError());
await should(model.azdataLogin()).be.rejectedWith(new UserCancelledError(loc.userCancelledError));
});
it('Reads password from cred store', async function (): Promise<void> {