mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
Add tests for authenticating user
This commit is contained in:
parent
80e58f765f
commit
aeba3083df
@ -61,5 +61,17 @@ defmodule Chess.AuthTest do
|
|||||||
user = user_fixture()
|
user = user_fixture()
|
||||||
assert %Ecto.Changeset{} = Auth.change_user(user)
|
assert %Ecto.Changeset{} = Auth.change_user(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "authenticate_user/1 returns false on incorrect password " do
|
||||||
|
user_fixture(username: "link", password: "eyeofsheikah")
|
||||||
|
assert Auth.authenticate_user("link", "shadowtemple") ==
|
||||||
|
{:error, "invalid password"}
|
||||||
|
end
|
||||||
|
|
||||||
|
test "authenticate_user/1 returns true on correct password " do
|
||||||
|
user = user_fixture(username: "link", password: "eyeofsheikah")
|
||||||
|
assert Auth.authenticate_user("link", "eyeofsheikah") ==
|
||||||
|
{:ok, user}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user