From c4e3f9eb02924d53d3a32e58324c2b5ac34aad49 Mon Sep 17 00:00:00 2001 From: Michael Mazour Date: Fri, 6 Jul 2018 11:05:40 +0100 Subject: [PATCH] Amend: tests for populating S3 settings from environment variable --- .../test/unit/coffee/SettingsTests.coffee | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 services/filestore/test/unit/coffee/SettingsTests.coffee diff --git a/services/filestore/test/unit/coffee/SettingsTests.coffee b/services/filestore/test/unit/coffee/SettingsTests.coffee new file mode 100644 index 0000000000..95278622ca --- /dev/null +++ b/services/filestore/test/unit/coffee/SettingsTests.coffee @@ -0,0 +1,22 @@ +assert = require("chai").assert +sinon = require('sinon') +chai = require('chai') +should = chai.should() +expect = chai.expect +modulePath = "../../../app/js/BucketController.js" +SandboxedModule = require('sandboxed-module') + +describe "Settings", -> + describe "s3", -> + it "should use JSONified env var if present", (done)-> + s3_settings = + key: 'default_key' + secret: 'default_secret' + bucket1: + auth_key: 'bucket1_key' + auth_secret: 'bucket1_secret' + process.env['S3_CREDENTIALS'] = JSON.stringify s3_settings + + settings =require('settings-sharelatex') + expect(settings.filestore.s3).to.deep.equal s3_settings + done()