Skip to content

Instantly share code, notes, and snippets.

@ozten
Created March 8, 2012 17:26
Show Gist options
  • Select an option

  • Save ozten/2002211 to your computer and use it in GitHub Desktop.

Select an option

Save ozten/2002211 to your computer and use it in GitHub Desktop.
require('./lib/test_env.js');
const
assert = require('assert'),
vows = require('vows'),
start_stop = require('./lib/start-stop.js'),
wsapi = require('./lib/wsapi.js'),
primary = require('../lib/primary.js');
const TEST_DOMAIN = 'example.domain',
TEST_ORIGIN = 'http://127.0.0.1:10002';
var suite = vows.describe('delegated-primary');
// start up a pristine server
start_stop.addStartupBatches(suite);
// Tests related to domains that delegate their authority to another
// primary.
// now let's generate an assertion using this user
suite.addBatch({
"Retrieving a public key is straight forward": {
topic: function() {
return primary.getPublicKey(TEST_DOMAIN, this.callback);
},
"succeeds": function(err, pubKey) {
console.log(err, pubKey);
assert.isString(pubKey);
}
}
});
// shut the server down and cleanup
start_stop.addShutdownBatches(suite);
// run or export the suite.
if (process.argv[1] === __filename) suite.run();
else suite.export(module);
tests just "hang"
ozten@haskwhal:~/Projects/browserid$ node tests/delegated-primary-test.js
Setting NODE_ENV to test_json to test with the local JSON database
To test with a local mysql database, setup mysql and set NODE_ENV to test_mysql
The "sys" module is now called "util". It should have a similar interface.
· · · can't get public key for example.domain undefined
✗ · ·
Retrieving a public key is straight forward
✗ succeeds
» expected undefined to be a String // delegated-primary-test.js:30
✗ Broken » 5 honored ∙ 1 broken (9.389s)
And server shutsdown before we call it
{"level":"info","message":"inserted primary info for 'example.domain' into cache, pointed at 'http://127.0.0.1:10005'","timestamp":"8 Mar 09:27:53"}
{"level":"warn","message":"SIGINT received. closing 0 connections and shutting down.","timestamp":"8 Mar 09:27:53"}
{"level":"info","message":"graceful shutdown complete...","timestamp":"8 Mar 09:27:53"}
{"level":"debug","message":"CheckSupport called example.domain","timestamp":"8 Mar 09:27:53"}
{"level":"debug","message":"g_cache={}","timestamp":"8 Mar 09:30:18"}
{"level":"debug","message":"example.domain is not a browserid primary: Error: getaddrinfo ENOENT","timestamp":"8 Mar 09:27:53"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment