show notebook as trusted when it belongs to a trusted book (#15093)

* check for trusted books

* don't add to trustedNotebooksMomento

* update comment

* added comments

* remove empty line
This commit is contained in:
Maddy
2021-04-15 10:30:51 -07:00
committed by GitHub
parent 4edbd6f3e7
commit bec1916c62
7 changed files with 26 additions and 5 deletions

View File

@@ -117,6 +117,7 @@ suite('CellToolbarActions', function (): void {
undefined,
undefined,
undefined,
undefined,
);
instantiationService.stub(INotificationService, new TestNotificationService());
instantiationService.stub(INotebookService, notebookService);

View File

@@ -71,6 +71,7 @@ suite('MarkdownTextTransformer', () => {
undefined,
undefined,
undefined,
undefined,
);
mockNotebookService = TypeMoq.Mock.ofInstance(notebookService);

View File

@@ -701,6 +701,7 @@ function setupServices(arg: { workbenchThemeService?: WorkbenchThemeService, ins
undefined,
undefined,
undefined,
undefined,
);
instantiationService.stub(INotebookService, notebookService);

View File

@@ -33,6 +33,8 @@ import { IProductService } from 'vs/platform/product/common/productService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { TestConfigurationService } from 'sql/platform/connection/test/common/testConfigurationService';
/**
* class to mock azdata.nb.ServerManager object
@@ -120,6 +122,7 @@ suite.skip('NotebookService:', function (): void {
didInstallExtensionEmitter: Emitter<DidInstallExtensionEvent>,
uninstallExtensionEmitter: Emitter<IExtensionIdentifier>,
didUninstallExtensionEmitter: Emitter<DidUninstallExtensionEvent>;
let configurationService: IConfigurationService;
setup(() => {
testNo++;
@@ -143,6 +146,7 @@ suite.skip('NotebookService:', function (): void {
didInstallExtensionEmitter = new Emitter<DidInstallExtensionEvent>();
uninstallExtensionEmitter = new Emitter<IExtensionIdentifier>();
didUninstallExtensionEmitter = new Emitter<DidUninstallExtensionEvent>();
configurationService = new TestConfigurationService();
instantiationService.stub(IExtensionManagementService, ExtensionManagementService);
instantiationService.stub(IExtensionManagementService, 'onInstallExtension', installExtensionEmitter.event);
@@ -159,7 +163,7 @@ suite.skip('NotebookService:', function (): void {
notebookService = new NotebookService(lifecycleService, storageService, extensionServiceMock.object, extensionManagementService,
instantiationService, fileService, logServiceMock.object, queryManagementService, contextService, productService,
editorService, untitledTextEditorService, editorGroupsService);
editorService, untitledTextEditorService, editorGroupsService, configurationService);
sandbox = sinon.sandbox.create();
});
@@ -457,7 +461,7 @@ suite.skip('NotebookService:', function (): void {
};
errorHandler.setUnexpectedErrorHandler(onUnexpectedErrorVerifier);
// The following call throws an exception internally with queryManagementService parameter being undefined.
new NotebookService(lifecycleService, storageService, extensionService, extensionManagementService, instantiationService, fileService, logService, /* queryManagementService */ undefined, contextService, productService, editorService, untitledTextEditorService, editorGroupsService);
new NotebookService(lifecycleService, storageService, extensionService, extensionManagementService, instantiationService, fileService, logService, /* queryManagementService */ undefined, contextService, productService, editorService, untitledTextEditorService, editorGroupsService, configurationService);
await unexpectedErrorPromise;
assert.strictEqual(unexpectedErrorCalled, true, `onUnexpectedError must be have been raised when queryManagementService is undefined when calling NotebookService constructor`);
});

View File

@@ -121,6 +121,7 @@ suite('Notebook Editor Model', function (): void {
undefined,
undefined,
undefined,
undefined,
);
let mockNotebookService = TypeMoq.Mock.ofInstance(notebookService);