Added logout test and fixed error in restwrite
This commit is contained in:
@@ -1576,5 +1576,27 @@ describe('Parse.User testing', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('ensure logout works', (done) => {
|
||||||
|
var user = null;
|
||||||
|
var sessionToken = null;
|
||||||
|
|
||||||
|
Parse.Promise.as().then(function() {
|
||||||
|
return Parse.User.signUp('log', 'out');
|
||||||
|
}).then((newUser) => {
|
||||||
|
user = newUser;
|
||||||
|
sessionToken = user.getSessionToken();
|
||||||
|
return Parse.User.logOut();
|
||||||
|
}).then(() => {
|
||||||
|
user.set('foo', 'bar');
|
||||||
|
return user.save(null, { sessionToken: sessionToken });
|
||||||
|
}).then(() => {
|
||||||
|
fail('Save should have failed.');
|
||||||
|
done();
|
||||||
|
}, (e) => {
|
||||||
|
expect(e.code).toEqual(Parse.Error.SESSION_MISSING);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ RestWrite.prototype.runDatabaseOperation = function() {
|
|||||||
this.query &&
|
this.query &&
|
||||||
!this.auth.couldUpdateUserId(this.query.objectId)) {
|
!this.auth.couldUpdateUserId(this.query.objectId)) {
|
||||||
throw new Parse.Error(Parse.Error.SESSION_MISSING,
|
throw new Parse.Error(Parse.Error.SESSION_MISSING,
|
||||||
'cannot modify user ' + this.objectId);
|
'cannot modify user ' + this.query.objectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add better detection for ACL, ensuring a user can't be locked from
|
// TODO: Add better detection for ACL, ensuring a user can't be locked from
|
||||||
|
|||||||
Reference in New Issue
Block a user