mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Suspicious logins report. (#6544)
This commit is contained in:
committed by
Régis Hanol
parent
f2b7254a99
commit
e0ccd36dbe
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user