diff options
Diffstat (limited to 'share/www/script/test/oauth.js')
-rw-r--r-- | share/www/script/test/oauth.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/share/www/script/test/oauth.js b/share/www/script/test/oauth.js index d55d13e8..b439b4db 100644 --- a/share/www/script/test/oauth.js +++ b/share/www/script/test/oauth.js @@ -94,8 +94,18 @@ couchTests.oauth = function(debug) { headers: {"X-Couch-Persist": "false"}, body: JSON.stringify(testadminPassword) }); - - CouchDB.request("GET", "/_sleep?time=50"); + var i = 0; + waitForSuccess(function() { + //loop until the couch server has processed the password + i += 1; + var xhr = CouchDB.request("GET", "http://" + host + "/_config/admins/testadmin?foo="+i,{ + headers: { + "Authorization": adminBasicAuthHeaderValue() + }}); + if (xhr.responseText.indexOf("\"-hashed-") != 0) { + throw("still waiting"); + } + }, "wait-for-admin"); CouchDB.newUuids(2); // so we have one to make the salt @@ -116,7 +126,7 @@ couchTests.oauth = function(debug) { // Create a user var jasonUserDoc = CouchDB.prepareUserDoc({ - username: "jason", + name: "jason", roles: ["test"] }, "testpassword"); T(usersDb.save(jasonUserDoc).ok); |