FIX: Heisentest - suspicious logins report was not ordered by date

The specs needed an order even though none was supplied.
This commit is contained in:
Robin Ward 2019-02-12 13:17:29 -05:00
parent 86fe423f5e
commit c23411cc69
2 changed files with 4 additions and 4 deletions

View File

@ -1441,6 +1441,7 @@ class Report
WHERE t.action = 'suspicious'
AND t.created_at >= :start_date
AND t.created_at <= :end_date
ORDER BY t.created_at DESC
SQL
DB.query(sql, start_date: report.start_date, end_date: report.end_date).each do |row|

View File

@ -1006,11 +1006,10 @@ describe Report do
context "with data" do
it "works" do
SiteSetting.verbose_auth_token_logging = true
freeze_time DateTime.parse('2017-03-01 12:00')
UserAuthToken.log(action: "suspicious", user_id: robin.id)
UserAuthToken.log(action: "suspicious", user_id: joffrey.id)
UserAuthToken.log(action: "suspicious", user_id: joffrey.id)
UserAuthToken.log(action: "suspicious", user_id: joffrey.id, created_at: 2.hours.ago)
UserAuthToken.log(action: "suspicious", user_id: joffrey.id, created_at: 3.hours.ago)
UserAuthToken.log(action: "suspicious", user_id: robin.id, created_at: 1.hour.ago)
report = Report.find("suspicious_logins")