diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2022-12-29 18:37:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-29 18:37:51 -0700 |
commit | c143bb549c53f2737c41cdfce6cc2598c5489bdc (patch) | |
tree | 33853e2a9c30ff7c670aa4ff5b73df005d6e6fec /test/auth/password_test.exs | |
parent | f7c2ccbe26dc808e4a7eae9a378e6c382220961a (diff) | |
parent | 479ca815e3a1760c71e8977674434b15f94ae833 (diff) | |
download | chessh-c143bb549c53f2737c41cdfce6cc2598c5489bdc.tar.gz chessh-c143bb549c53f2737c41cdfce6cc2598c5489bdc.zip |
Merge pull request #1 from Simponic/erlang_ssh_server
Diffstat (limited to 'test/auth/password_test.exs')
-rw-r--r-- | test/auth/password_test.exs | 18 |
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 |