mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
Fixed broken spam prevention test (#10281)
* Fixed broken spam prevention test closes #10280 * Improved spam prevention test
This commit is contained in:
parent
7cce71d997
commit
43ce1f02c1
@ -87,13 +87,18 @@ describe('Spam Prevention API', function () {
|
||||
it('Ensure reset works: password grant type', function () {
|
||||
return executeRequests(userAllowedAttempts - 1, loginAttempt, owner.email, incorrectPassword)
|
||||
.then(() => loginAttempt(owner.email, correctPassword))
|
||||
.then(() => {
|
||||
return db.knex('brute').select()
|
||||
.then(function (rows) {
|
||||
// if reset works, the key is deleted and only one key remains in the database
|
||||
// the one key is the key for global block
|
||||
rows.length.should.eql(1);
|
||||
});
|
||||
// CASE: login in with bad credentials twice - which would
|
||||
// take us over the limit if the block hasn't been reset
|
||||
.then(() => loginAttempt(owner.email, incorrectPassword))
|
||||
.then(() => loginAttempt(owner.email, incorrectPassword))
|
||||
.then((res) => {
|
||||
// CASE: the reset means that we should be able to attempt to log in again
|
||||
// and not get a too many requests error
|
||||
const error = res.body.errors[0];
|
||||
should.exist(error.errorType);
|
||||
res.statusCode.should.eql(422);
|
||||
error.errorType.should.eql('ValidationError');
|
||||
error.message.should.eql('Your password is incorrect.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user