mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
test login for non-existant user
This commit is contained in:
@@ -147,6 +147,33 @@ describe('authentication', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should fail to login if user does not exist', function (done) {
|
||||
var jar = request.jar();
|
||||
request({
|
||||
url: nconf.get('url') + '/api/config',
|
||||
json: true,
|
||||
jar: jar,
|
||||
}, function (err, response, body) {
|
||||
assert.ifError(err);
|
||||
|
||||
request.post(nconf.get('url') + '/login', {
|
||||
form: {
|
||||
username: 'doesnotexist',
|
||||
password: 'nopassword',
|
||||
},
|
||||
json: true,
|
||||
jar: jar,
|
||||
headers: {
|
||||
'x-csrf-token': body.csrf_token,
|
||||
},
|
||||
}, function (err, response, body) {
|
||||
assert.equal(response.statusCode, 403);
|
||||
assert.equal(body, '[[error:invalid-login-credentials]]');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
after(function (done) {
|
||||
db.emptydb(done);
|
||||
|
||||
Reference in New Issue
Block a user