1
0
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:
Daniel Barber 2018-01-15 21:52:01 -05:00
parent 80e58f765f
commit aeba3083df
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8

View File

@ -61,5 +61,17 @@ defmodule Chess.AuthTest do
user = user_fixture()
assert %Ecto.Changeset{} = Auth.change_user(user)
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