-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (WIP): Remove all
keycloak_auth?
branching
Now that all of our environments have switched to Keycloak for auth, we no longer need to support the local auth option.
- Loading branch information
Showing
17 changed files
with
73 additions
and
589 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,6 @@ defmodule AlertProcessor.Model.UserTest do | |
"communication_mode" => "email" | ||
} | ||
@invalid_attrs %{} | ||
@password "password1" | ||
@encrypted_password Bcrypt.hash_pwd_salt(@password) | ||
@disabled_password "" | ||
|
||
describe "user changeset" do | ||
test "changeset with valid attributes" do | ||
|
@@ -194,58 +191,6 @@ defmodule AlertProcessor.Model.UserTest do | |
end | ||
end | ||
|
||
describe "authenticate/1" do | ||
test "authenticates if email and password valid" do | ||
Repo.insert!(%User{ | ||
email: "[email protected]", | ||
role: "user", | ||
encrypted_password: @encrypted_password | ||
}) | ||
|
||
assert {:ok, _} = User.authenticate(%{"email" => "[email protected]", "password" => @password}) | ||
end | ||
|
||
test "does not authenticate if invalid password for existing user" do | ||
Repo.insert!(%User{ | ||
email: "[email protected]", | ||
role: "user", | ||
encrypted_password: @encrypted_password | ||
}) | ||
|
||
assert {:error, _} = | ||
User.authenticate(%{ | ||
"email" => "[email protected]", | ||
"password" => "different_password" | ||
}) | ||
end | ||
|
||
test "does not authenticate if user doesn't exist" do | ||
assert {:error, _} = | ||
User.authenticate(%{"email" => "[email protected]", "password" => @password}) | ||
end | ||
|
||
test "does not authenticate if user's account is disabled" do | ||
Repo.insert!(%User{ | ||
email: "[email protected]", | ||
role: "user", | ||
encrypted_password: @disabled_password | ||
}) | ||
|
||
assert {:error, :disabled} = | ||
User.authenticate(%{"email" => "[email protected]", "password" => @password}) | ||
end | ||
|
||
test "email is not case sensitive" do | ||
Repo.insert!(%User{ | ||
email: "[email protected]", | ||
role: "user", | ||
encrypted_password: @encrypted_password | ||
}) | ||
|
||
assert {:ok, _} = User.authenticate(%{"email" => "[email protected]", "password" => @password}) | ||
end | ||
end | ||
|
||
describe "set_email_rejection/2" do | ||
test "sets a user's email rejection status and disables notifications" do | ||
user = insert(:user, communication_mode: "email", email_rejection_status: nil) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.