summaryrefslogtreecommitdiff
path: root/test/auth/password_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/auth/password_test.exs')
-rw-r--r--test/auth/password_test.exs18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/auth/password_test.exs b/test/auth/password_test.exs
index 974f2fa..8c93ea9 100644
--- a/test/auth/password_test.exs
+++ b/test/auth/password_test.exs
@@ -1,27 +1,27 @@
defmodule Chessh.Auth.PasswordAuthenticatorTest do
use ExUnit.Case
- alias Chessh.Player
- alias Chessh.Repo
+ alias Chessh.{Player, Repo}
@valid_user %{username: "logan", password: "password"}
- setup do
- :ok = Ecto.Adapters.SQL.Sandbox.checkout(Chessh.Repo)
+ setup_all do
+ Ecto.Adapters.SQL.Sandbox.checkout(Repo)
+ Ecto.Adapters.SQL.Sandbox.mode(Repo, {:shared, self()})
{:ok, _user} = Repo.insert(Player.registration_changeset(%Player{}, @valid_user))
:ok
end
- test "User can sign in with their password" do
+ test "Password can authenticate a hashed password" do
assert Chessh.Auth.PasswordAuthenticator.authenticate(
- String.to_charlist(@valid_user.username),
- String.to_charlist(@valid_user.password)
+ @valid_user.username,
+ @valid_user.password
)
refute Chessh.Auth.PasswordAuthenticator.authenticate(
- String.to_charlist(@valid_user.username),
- String.to_charlist("a_bad_password")
+ @valid_user.username,
+ "a_bad_password"
)
end
end