You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2012/04/26 15:50:15 UTC
git commit: Use TEquals for great good
Updated Branches:
refs/heads/master 6214d8488 -> f6b97ee0c
Use TEquals for great good
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/f6b97ee0
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/f6b97ee0
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/f6b97ee0
Branch: refs/heads/master
Commit: f6b97ee0c452233785dcd9b38699fc3935f9b107
Parents: 6214d84
Author: Robert Newson <rn...@apache.org>
Authored: Thu Apr 26 14:49:55 2012 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Thu Apr 26 14:49:55 2012 +0100
----------------------------------------------------------------------
share/www/script/test/cookie_auth.js | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/f6b97ee0/share/www/script/test/cookie_auth.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/cookie_auth.js b/share/www/script/test/cookie_auth.js
index 066af85..40b633b 100644
--- a/share/www/script/test/cookie_auth.js
+++ b/share/www/script/test/cookie_auth.js
@@ -80,7 +80,7 @@ couchTests.cookie_auth = function(debug) {
T(usersDb.save(jasonUserDoc).ok);
var checkDoc = open_as(usersDb, jasonUserDoc._id, "jan");
- T(checkDoc.name == "Jason Davies");
+ TEquals("Jason Davies", checkDoc.name);
var jchrisUserDoc = CouchDB.prepareUserDoc({
name: "jchris@apache.org"
@@ -96,8 +96,8 @@ couchTests.cookie_auth = function(debug) {
usersDb.save(duplicateJchrisDoc);
T(false && "Can't create duplicate user names. Should have thrown an error.");
} catch (e) {
- T(e.error == "conflict");
- T(usersDb.last_req.status == 409);
+ TEquals("conflict", e.error);
+ TEquals(409, usersDb.last_req.status);
}
// we can't create _names
@@ -109,8 +109,8 @@ couchTests.cookie_auth = function(debug) {
usersDb.save(underscoreUserDoc);
T(false && "Can't create underscore user names. Should have thrown an error.");
} catch (e) {
- T(e.error == "forbidden");
- T(usersDb.last_req.status == 403);
+ TEquals("forbidden", e.error);
+ TEquals(403, usersDb.last_req.status);
}
// we can't create docs with malformed ids
@@ -124,13 +124,13 @@ couchTests.cookie_auth = function(debug) {
usersDb.save(badIdDoc);
T(false && "Can't create malformed docids. Should have thrown an error.");
} catch (e) {
- T(e.error == "forbidden");
- T(usersDb.last_req.status == 403);
+ TEquals("forbidden", e.error);
+ TEquals(403, usersDb.last_req.status);
}
// login works
T(CouchDB.login('Jason Davies', password).ok);
- T(CouchDB.session().userCtx.name == 'Jason Davies');
+ TEquals('Jason Davies', CouchDB.session().userCtx.name);
// JSON login works
var xhr = CouchDB.request("POST", "/_session", {
@@ -142,7 +142,7 @@ couchTests.cookie_auth = function(debug) {
});
T(JSON.parse(xhr.responseText).ok);
- T(CouchDB.session().userCtx.name == 'Jason Davies');
+ TEquals('Jason Davies', CouchDB.session().userCtx.name);
// update one's own credentials document
jasonUserDoc.foo=2;
@@ -153,8 +153,8 @@ couchTests.cookie_auth = function(debug) {
usersDb.deleteDoc(jchrisUserDoc);
T(false && "Can't delete other users docs. Should have thrown an error.");
} catch (e) {
- T(e.error == "forbidden");
- T(usersDb.last_req.status == 403);
+ TEquals("forbidden", e.error);
+ TEquals(403, usersDb.last_req.status);
}
// TODO should login() throw an exception here?