Updating ssl configuration keys and tests

This commit is contained in:
Javier Cervantes 2014-04-24 10:14:02 -05:00
parent e5400341d0
commit 956e757e8e
2 changed files with 10 additions and 10 deletions

View File

@ -46,8 +46,6 @@ var Cylon = (function() {
this.api_config = { this.api_config = {
host: '127.0.0.1', host: '127.0.0.1',
port: '3000', port: '3000',
cert: null,
key: null,
auth: {}, auth: {},
CORS: null, CORS: null,
ssl: null ssl: null
@ -102,7 +100,7 @@ var Cylon = (function() {
Master.prototype.api = function(opts) { Master.prototype.api = function(opts) {
if (opts == null) { opts = {}; } if (opts == null) { opts = {}; }
var keys = ['host', 'port', 'auth', 'cert', 'CORS', 'key', 'ssl']; var keys = ['host', 'port', 'auth', 'CORS', 'ssl'];
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
var key = keys[i]; var key = keys[i];

View File

@ -42,10 +42,9 @@ describe("Cylon", function() {
expectedConfig = { expectedConfig = {
host: '127.0.0.1', host: '127.0.0.1',
port: '3000', port: '3000',
cert: null,
key: null,
auth: {}, auth: {},
CORS: null CORS: null,
ssl: {}
}; };
// this is the shortest, cheapest way to dup an object in JS. // this is the shortest, cheapest way to dup an object in JS.
@ -90,12 +89,15 @@ describe("Cylon", function() {
}); });
}); });
context("specifiying new SSL key and cert", function() { context("specifiying SSL key and cert", function() {
it("changes the SSL key and cert", function() { it("changes the SSL key and cert", function() {
expectedConfig.cert = "/path/to/cert/file"; expectedConfig.ssl.cert = "/path/to/cert/file";
expectedConfig.key = "/path/to/key/file"; expectedConfig.ssl.key = "/path/to/key/file";
cylon.api({ cert: "/path/to/cert/file", key: "/path/to/key/file" }); cylon.api({ ssl: {
cert: "/path/to/cert/file",
key: "/path/to/key/file" }
});
expect(cylon.api_config).to.be.eql(expectedConfig); expect(cylon.api_config).to.be.eql(expectedConfig);
}) })