FEATURE: Suspicious logins report. (#6544)

This commit is contained in:
Bianca Nenciu
2018-10-31 00:51:58 +02:00
committed by Régis Hanol
parent f2b7254a99
commit e0ccd36dbe
5 changed files with 116 additions and 0 deletions

View File

@@ -973,4 +973,25 @@ describe Report do
end
end
end
describe "report_suspicious_logins" do
let(:joffrey) { Fabricate(:user, username: "joffrey") }
let(:robin) { Fabricate(:user, username: "robin") }
context "with data" do
it "works" do
UserAuthToken.log(action: "suspicious", user_id: robin.id)
UserAuthToken.log(action: "suspicious", user_id: joffrey.id)
UserAuthToken.log(action: "suspicious", user_id: joffrey.id)
report = Report.find("suspicious_logins")
expect(report.data.length).to eq(3)
expect(report.data[0][:username]).to eq("robin")
expect(report.data[1][:username]).to eq("joffrey")
expect(report.data[2][:username]).to eq("joffrey")
end
end
end
end