Add github id in player structs for tests

This commit is contained in:
Logan Hunt 2023-01-19 13:51:38 -07:00
parent e0bf863949
commit bd96a70ad9
No known key found for this signature in database
GPG Key ID: 8AC6A4B840C0EC49
6 changed files with 9 additions and 12 deletions

View File

@ -55,8 +55,8 @@ export const Home = () => {
}
return (
<div>
<>
<p>Looks like you're not signed in 👀. </p>
</div>
</>
);
};

View File

@ -1,3 +0,0 @@
TODO:
- [ ] When password changed, remove all sessions
- [ ] When session removed, ssh connection closed

View File

@ -2,7 +2,7 @@ defmodule Chessh.Auth.PasswordAuthenticatorTest do
use ExUnit.Case
alias Chessh.{Player, Repo}
@valid_user %{username: "logan", password: "password"}
@valid_user %{username: "logan", password: "password", github_id: 1}
setup_all do
Ecto.Adapters.SQL.Sandbox.checkout(Repo)

View File

@ -2,7 +2,7 @@ defmodule Chessh.Auth.PublicKeyAuthenticatorTest do
use ExUnit.Case
alias Chessh.{Key, Repo, Player}
@valid_user %{username: "logan", password: "password"}
@valid_user %{username: "logan", password: "password", github_id: 2}
@valid_key %{
name: "The Gamer Machine",
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ/2LOJGGEd/dhFgRxJ5MMv0jJw4s4pA8qmMbZyulN44"

View File

@ -3,10 +3,10 @@ defmodule Chessh.Auth.UserRegistrationTest do
use ExUnit.Case
alias Chessh.{Player, Repo}
@valid_user %{username: "logan", password: "password"}
@invalid_username %{username: "a", password: "password"}
@invalid_password %{username: "aasdf", password: "pass"}
@repeated_username %{username: "LoGan", password: "password"}
@valid_user %{username: "logan", password: "password", github_id: 4}
@invalid_username %{username: "a", password: "password", github_id: 7}
@invalid_password %{username: "aasdf", password: "pass", github_id: 6}
@repeated_username %{username: "LoGan", password: "password", github_id: 5}
test "Password must be at least 8 characters and username must be at least 2" do
refute Player.registration_changeset(%Player{}, @invalid_password).valid?

View File

@ -5,7 +5,7 @@ defmodule Chessh.SSH.AuthTest do
@localhost '127.0.0.1'
@localhost_inet {{127, 0, 0, 1}, 1}
@key_name "The Gamer Machine"
@valid_user %{username: "logan", password: "password"}
@valid_user %{username: "logan", password: "password", github_id: 3}
@client_test_keys_dir Path.join(Application.compile_env!(:chessh, :key_dir), "client_keys")
@client_pub_key 'id_ed25519.pub'