Remove unnecessary OutputChannel reference from PythonPathLookup class. (#13970)

This commit is contained in:
Cory Rivera
2021-01-15 16:51:42 -08:00
committed by GitHub
parent 462d4137d5
commit 94b697340d
6 changed files with 25 additions and 28 deletions

View File

@@ -13,16 +13,14 @@ import { PickPackagesPage } from '../../dialog/configurePython/pickPackagesPage'
import { python3DisplayName, allKernelsName } from '../../common/constants';
import { TestContext, createViewContext, TestButton } from '../common';
import { EventEmitter } from 'vscode';
import { MockOutputChannel } from '../common/stubs';
import { PythonPathLookup } from '../../dialog/pythonPathLookup';
describe('Configure Python Wizard', function () {
let testWizard: ConfigurePythonWizard;
let viewContext: TestContext;
let testInstallation: JupyterServerInstallation;
let mockOutputChannel: TypeMoq.IMock<MockOutputChannel>;
beforeEach(() => {
mockOutputChannel = TypeMoq.Mock.ofType(MockOutputChannel);
let mockInstall = TypeMoq.Mock.ofType(JupyterServerInstallation);
mockInstall.setup(i => i.getInstalledPipPackages(TypeMoq.It.isAnyString())).returns(() => Promise.resolve([]));
mockInstall.setup(i => i.getRequiredPackagesForKernel(TypeMoq.It.isAnyString())).returns(() => [{ name: 'TestPkg', version: '1.0.0'}]);
@@ -44,21 +42,21 @@ describe('Configure Python Wizard', function () {
});
it('Start wizard test', async () => {
let wizard = new ConfigurePythonWizard(testInstallation, mockOutputChannel.object);
let wizard = new ConfigurePythonWizard(testInstallation);
await wizard.start();
await wizard.close();
await should(wizard.setupComplete).be.resolved();
});
it('Reject setup on cancel test', async () => {
let wizard = new ConfigurePythonWizard(testInstallation, mockOutputChannel.object);
let wizard = new ConfigurePythonWizard(testInstallation);
await wizard.start(undefined, true);
await wizard.close();
await should(wizard.setupComplete).be.rejected();
});
it('Error message test', async () => {
let wizard = new ConfigurePythonWizard(testInstallation, mockOutputChannel.object);
let wizard = new ConfigurePythonWizard(testInstallation);
await wizard.start();
should(wizard.wizard.message).be.undefined();
@@ -72,16 +70,21 @@ describe('Configure Python Wizard', function () {
should(wizard.wizard.message).be.undefined();
await wizard.close();
await should(wizard.setupComplete).be.resolved();
});
it('Configure Path Page test', async () => {
let testPythonLocation = '/not/a/real/path';
let model = <ConfigurePythonModel>{
useExistingPython: true,
pythonPathsPromise: Promise.resolve([{
let mockPathLookup = TypeMoq.Mock.ofType(PythonPathLookup);
mockPathLookup.setup(p => p.getSuggestions()).returns(() =>
Promise.resolve([{
installDir: testPythonLocation,
version: '4000'
}])
);
let model = <ConfigurePythonModel>{
useExistingPython: true,
pythonPathLookup: mockPathLookup.object
};
let page = azdata.window.createWizardPage('Page 1');