Reenabling book trust manager tests (#23594)

* Reenabling book trust manager tests

* Also fix trustbook test
This commit is contained in:
Chris LaFreniere
2023-07-06 15:47:16 -07:00
committed by GitHub
parent 718bc0d737
commit 6125708b25
5 changed files with 21 additions and 24 deletions

View File

@@ -210,17 +210,15 @@ describe('BooksTreeViewTests', function () {
equalBookItems(notebook3, expectedNotebook3);
});
// {{SQL CARBON TODO}} - disable failing test
it.skip('should set notebooks trusted to true on trustBook', async () => {
it('should set notebooks trusted to true on trustBook', async () => {
let notebook1Path = notebook1.tooltip;
let bookTrustManager: BookTrustManager = new BookTrustManager(bookTreeViewProvider.books);
let isTrusted = bookTrustManager.isNotebookTrustedByDefault(notebook1Path);
should(isTrusted).equal(false, 'Notebook should not be trusted by default');
bookTreeViewProvider.trustBook(notebook1);
await bookTreeViewProvider.trustBook(notebook1);
isTrusted = bookTrustManager.isNotebookTrustedByDefault(notebook1Path);
should(isTrusted).equal(true, 'Failed to set trust on trustBook');
});
it('getNavigation should get previous and next urls correctly from the bookModel', async () => {

View File

@@ -182,7 +182,7 @@ describe('BookTrustManagerTests', function () {
should(isNotebookTrustedBeforeChange).be.false('Notebook should NOT be trusted');
// add another book subfolder
bookTrustManager.setBookAsTrusted('/SubFolder2/', true);
await bookTrustManager.setBookAsTrusted('/SubFolder2/', true);
let isNotebookTrustedAfterChange = bookTrustManager.isNotebookTrustedByDefault(notebookUri);
@@ -211,7 +211,7 @@ describe('BookTrustManagerTests', function () {
});
it('should NOT trust notebook inside trusted subfolder when absent in table of contents ', async () => {
bookTrustManager.setBookAsTrusted('/temp/SubFolder/', true);
await bookTrustManager.setBookAsTrusted('/temp/SubFolder/', true);
let notebookUri = run.book1.notInTocNb;
let isNotebookTrusted = bookTrustManager.isNotebookTrustedByDefault(notebookUri);
@@ -222,8 +222,7 @@ describe('BookTrustManagerTests', function () {
});
});
// {{SQL CARBON TODO}} - reenable this test suite https://github.com/microsoft/azuredatastudio/issues/23540
describe.skip('TrustingInFolder', () => {
describe('TrustingInFolder', () => {
let bookTrustManager: IBookTrustManager;
let books: BookModel[];
@@ -330,7 +329,7 @@ describe('BookTrustManagerTests', function () {
});
it('should trust notebooks in a trusted book in a folder', async () => {
bookTrustManager.setBookAsTrusted('/temp/SubFolder/', true);
await bookTrustManager.setBookAsTrusted('/temp/SubFolder/', true);
let notebookUri1 = run.book1.notebook1;
let notebookUri2 = run.book1.notebook2;
@@ -345,7 +344,7 @@ describe('BookTrustManagerTests', function () {
it('should NOT trust a notebook in an untrusted book in a folder', async () => {
//Set book as not trusted before running test
bookTrustManager.setBookAsTrusted('/temp/SubFolder2/', false);
await bookTrustManager.setBookAsTrusted('/temp/SubFolder2/', false);
let notebookUri = run.book2.notebook1;
let isNotebookTrusted = bookTrustManager.isNotebookTrustedByDefault(notebookUri);
@@ -355,13 +354,13 @@ describe('BookTrustManagerTests', function () {
it('should trust notebook after book has been added to a folder', async () => {
//Set book as not trusted before running test
bookTrustManager.setBookAsTrusted('/temp/SubFolder2/', false);
await bookTrustManager.setBookAsTrusted('/temp/SubFolder2/', false);
let notebookUri = run.book2.notebook1;
let isNotebookTrustedBeforeChange = bookTrustManager.isNotebookTrustedByDefault(notebookUri);
should(isNotebookTrustedBeforeChange).be.false('Notebook should NOT be trusted');
bookTrustManager.setBookAsTrusted('/temp/SubFolder2/', true);
await bookTrustManager.setBookAsTrusted('/temp/SubFolder2/', true);
let isNotebookTrustedAfterChange = bookTrustManager.isNotebookTrustedByDefault(notebookUri);
@@ -369,8 +368,8 @@ describe('BookTrustManagerTests', function () {
});
it('should NOT trust a notebook when removing all books from folders', async () => {
bookTrustManager.setBookAsTrusted('/temp/SubFolder/', true);
bookTrustManager.setBookAsTrusted('/temp/SubFolder2/', true);
await bookTrustManager.setBookAsTrusted('/temp/SubFolder/', true);
await bookTrustManager.setBookAsTrusted('/temp/SubFolder2/', true);
let notebookUri = run.book1.notebook1;
let isNotebookTrusted = bookTrustManager.isNotebookTrustedByDefault(notebookUri);
let notebook2Uri = run.book2.notebook1;
@@ -396,7 +395,7 @@ describe('BookTrustManagerTests', function () {
});
it('should NOT trust notebook inside trusted subfolder when absent in table of contents ', async () => {
bookTrustManager.setBookAsTrusted('/temp/SubFolder/', true);
await bookTrustManager.setBookAsTrusted('/temp/SubFolder/', true);
let notebookUri = run.book1.notInTocNb;
let isNotebookTrusted = bookTrustManager.isNotebookTrustedByDefault(notebookUri);