Permalink
Browse files

test for nano.session

  • Loading branch information...
1 parent 7cc0433 commit 2fbdea95688dfd38b066c7a73bd2461934832e33 @pgte pgte committed Jan 21, 2014
Showing with 10 additions and 2 deletions.
  1. +10 −2 tests/shared/cookie.js
@@ -24,10 +24,10 @@ specify("shared_cookie:setup", timeout, function (assert) {
}, function (err, response, headers) {
assert.equal(err, undefined, "Failed to create admin user");
// authenticate
- nano.auth(helpers.username, helpers.password,
+ nano.auth(helpers.username, helpers.password,
function (err, response, headers) {
assert.equal(err, undefined, "Should have logged in successfully");
- assert.ok(headers['set-cookie'],
+ assert.ok(headers['set-cookie'],
"Response should have a set-cookie header");
cookie = headers['set-cookie'];
});
@@ -46,6 +46,14 @@ specify("shared_cookie:test", timeout, function (assert) {
});
});
+specify("shared_cookie:get_session", timeout, function (assert) {
+ var server = Nano({ url : helpers.couch, cookie: cookie });
+ server.session(function(error, session) {
+ assert.equal(error, undefined, "Should have gotten the session");
+ assert.equal(session.userCtx.name, helpers.username);
+ });
+});
+
specify("shared_cookie:teardown", timeout, function (assert) {
// back to admin party mode
admin.relax(

0 comments on commit 2fbdea9

Please sign in to comment.