From 3115c472fb705de894739f574c2b0266f3fa3e0b Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Sun, 23 Aug 2020 01:35:45 +0200 Subject: Added dropbox.appKey to test config to fix failing tests Signed-off-by: Erik Michelson --- test/csp.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/csp.js b/test/csp.js index 8cf24b9a..0b00ecbb 100644 --- a/test/csp.js +++ b/test/csp.js @@ -27,7 +27,10 @@ describe('Content security policies', function () { upgradeInsecureRequests: 'auto', reportURI: undefined }, - useCDN: true + useCDN: true, + dropbox: { + appKey: undefined + } } }) -- cgit v1.2.3 From c2c28d3aeb4f3db92991bf77cd8e8dfa1be2268f Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Sun, 23 Aug 2020 01:41:55 +0200 Subject: Add test for dropbox csp rule Signed-off-by: Erik Michelson --- test/csp.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/csp.js b/test/csp.js index 0b00ecbb..d081cef0 100644 --- a/test/csp.js +++ b/test/csp.js @@ -81,6 +81,16 @@ describe('Content security policies', function () { assert(!csp.computeDirectives().fontSrc.includes('https://*.disquscdn.com')) }) + it('Include dropbox if configured', function () { + let testconfig = defaultConfig + testconfig.dropbox.appKey = 'hedgedoc' + mock('../lib/config', testconfig) + csp = mock.reRequire('../lib/csp') + + assert(csp.computeDirectives().scriptSrc.includes('https://www.dropbox.com')) + assert(csp.computeDirectives().scriptSrc.includes('\'unsafe-inline\'')) + }) + it('Set ReportURI', function () { let testconfig = defaultConfig testconfig.csp.reportURI = 'https://example.com/reportURI' -- cgit v1.2.3