From 9f2651578b7bd5105aae44ce9ed2d31e6ab7cade Mon Sep 17 00:00:00 2001 From: Ritchie Martori Date: Tue, 17 Dec 2013 21:34:30 -0800 Subject: [PATCH] fixup - Include accessToken in user logout tests --- test/user.test.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/user.test.js b/test/user.test.js index 780d7c18..fecc52d8 100644 --- a/test/user.test.js +++ b/test/user.test.js @@ -17,6 +17,7 @@ describe('User', function(){ }); beforeEach(function (done) { + app.use(loopback.token()); app.use(loopback.rest()); app.model(User); @@ -153,7 +154,6 @@ describe('User', function(){ it('Logout a user by providing the current accessToken id (over rest)', function(done) { login(logout); - function login(fn) { request(app) .post('/users/login') @@ -171,22 +171,22 @@ describe('User', function(){ }); } - function logout(err, sid) { + function logout(err, token) { request(app) - .post('/users/logout') + .post('/users/logout') + .set('Authorization', token) .expect(204) - .send({sid: sid}) - .end(verify(sid, done)); + .end(verify(token, done)); } }); - function verify(sid, done) { - assert(sid); + function verify(token, done) { + assert(token); return function (err) { if(err) return done(err); - AccessToken.findById(sid, function (err, accessToken) { + AccessToken.findById(token, function (err, accessToken) { assert(!accessToken, 'accessToken should not exist after logging out'); done(err); });