summaryrefslogtreecommitdiff
path: root/test/auth
diff options
context:
space:
mode:
Diffstat (limited to 'test/auth')
-rw-r--r--test/auth/password_test.exs7
-rw-r--r--test/auth/pubkey_test.exs6
2 files changed, 5 insertions, 8 deletions
diff --git a/test/auth/password_test.exs b/test/auth/password_test.exs
index 974f2fa..1516bdf 100644
--- a/test/auth/password_test.exs
+++ b/test/auth/password_test.exs
@@ -1,11 +1,10 @@
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
+ setup_all do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Chessh.Repo)
{:ok, _user} = Repo.insert(Player.registration_changeset(%Player{}, @valid_user))
@@ -13,7 +12,7 @@ defmodule Chessh.Auth.PasswordAuthenticatorTest do
: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)
diff --git a/test/auth/pubkey_test.exs b/test/auth/pubkey_test.exs
index 78eecfb..d8236e3 100644
--- a/test/auth/pubkey_test.exs
+++ b/test/auth/pubkey_test.exs
@@ -1,8 +1,6 @@
defmodule Chessh.Auth.PublicKeyAuthenticatorTest do
use ExUnit.Case
- alias Chessh.Key
- alias Chessh.Repo
- alias Chessh.Player
+ alias Chessh.{Key, Repo, Player}
@valid_user %{username: "logan", password: "password"}
@valid_key %{
@@ -10,7 +8,7 @@ defmodule Chessh.Auth.PublicKeyAuthenticatorTest do
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ/2LOJGGEd/dhFgRxJ5MMv0jJw4s4pA8qmMbZyulN44"
}
- setup do
+ setup_all do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Chessh.Repo)
{:ok, player} = Repo.insert(Player.registration_changeset(%Player{}, @valid_user))