-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Toby Archer
committed
Aug 25, 2023
1 parent
a18a92f
commit 05efa59
Showing
11 changed files
with
120 additions
and
13 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,3 @@ | |
</h2> | ||
|
||
<ExampleWeb.Flow.flow flow={@flow} /> | ||
|
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 |
---|---|---|
|
@@ -3,4 +3,3 @@ | |
</h2> | ||
|
||
<ExampleWeb.Flow.flow flow={@flow} /> | ||
|
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
defmodule ExampleWeb.Helpers do | ||
|
||
@doc """ | ||
Helper function to format request cookie map into string | ||
""" | ||
|
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
108 changes: 108 additions & 0 deletions
108
elixir-ory-network/test/example_web/live/auth_live_test.exs
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 |
---|---|---|
@@ -0,0 +1,108 @@ | ||
defmodule ExampleWeb.AuthLiveTest do | ||
use ExampleWeb.ConnCase | ||
|
||
import Phoenix.LiveViewTest | ||
import Example.AccountsFixtures | ||
|
||
@create_attrs %{} | ||
@update_attrs %{} | ||
@invalid_attrs %{} | ||
|
||
defp create_auth(_) do | ||
auth = auth_fixture() | ||
%{auth: auth} | ||
end | ||
|
||
describe "Index" do | ||
setup [:create_auth] | ||
|
||
test "lists all auth", %{conn: conn} do | ||
{:ok, _index_live, html} = live(conn, ~p"/auth") | ||
|
||
assert html =~ "Listing Auth" | ||
end | ||
|
||
test "saves new auth", %{conn: conn} do | ||
{:ok, index_live, _html} = live(conn, ~p"/auth") | ||
|
||
assert index_live |> element("a", "New Auth") |> render_click() =~ | ||
"New Auth" | ||
|
||
assert_patch(index_live, ~p"/auth/new") | ||
|
||
assert index_live | ||
|> form("#auth-form", auth: @invalid_attrs) | ||
|> render_change() =~ "can't be blank" | ||
|
||
assert index_live | ||
|> form("#auth-form", auth: @create_attrs) | ||
|> render_submit() | ||
|
||
assert_patch(index_live, ~p"/auth") | ||
|
||
html = render(index_live) | ||
assert html =~ "Auth created successfully" | ||
end | ||
|
||
test "updates auth in listing", %{conn: conn, auth: auth} do | ||
{:ok, index_live, _html} = live(conn, ~p"/auth") | ||
|
||
assert index_live |> element("#auth-#{auth.id} a", "Edit") |> render_click() =~ | ||
"Edit Auth" | ||
|
||
assert_patch(index_live, ~p"/auth/#{auth}/edit") | ||
|
||
assert index_live | ||
|> form("#auth-form", auth: @invalid_attrs) | ||
|> render_change() =~ "can't be blank" | ||
|
||
assert index_live | ||
|> form("#auth-form", auth: @update_attrs) | ||
|> render_submit() | ||
|
||
assert_patch(index_live, ~p"/auth") | ||
|
||
html = render(index_live) | ||
assert html =~ "Auth updated successfully" | ||
end | ||
|
||
test "deletes auth in listing", %{conn: conn, auth: auth} do | ||
{:ok, index_live, _html} = live(conn, ~p"/auth") | ||
|
||
assert index_live |> element("#auth-#{auth.id} a", "Delete") |> render_click() | ||
refute has_element?(index_live, "#auth-#{auth.id}") | ||
end | ||
end | ||
|
||
describe "Show" do | ||
setup [:create_auth] | ||
|
||
test "displays auth", %{conn: conn, auth: auth} do | ||
{:ok, _show_live, html} = live(conn, ~p"/auth/#{auth}") | ||
|
||
assert html =~ "Show Auth" | ||
end | ||
|
||
test "updates auth within modal", %{conn: conn, auth: auth} do | ||
{:ok, show_live, _html} = live(conn, ~p"/auth/#{auth}") | ||
|
||
assert show_live |> element("a", "Edit") |> render_click() =~ | ||
"Edit Auth" | ||
|
||
assert_patch(show_live, ~p"/auth/#{auth}/show/edit") | ||
|
||
assert show_live | ||
|> form("#auth-form", auth: @invalid_attrs) | ||
|> render_change() =~ "can't be blank" | ||
|
||
assert show_live | ||
|> form("#auth-form", auth: @update_attrs) | ||
|> render_submit() | ||
|
||
assert_patch(show_live, ~p"/auth/#{auth}") | ||
|
||
html = render(show_live) | ||
assert html =~ "Auth updated successfully" | ||
end | ||
end | ||
end |