forked from shibao/cannery
pass user auth test
This commit is contained in:
parent
6f02310880
commit
b319f5640a
@ -1,10 +1,13 @@
|
|||||||
defmodule CanneryWeb.UserAuthTest do
|
defmodule CanneryWeb.UserAuthTest do
|
||||||
use CanneryWeb.ConnCase, async: true
|
@moduledoc """
|
||||||
|
Tests user auth
|
||||||
|
"""
|
||||||
|
|
||||||
|
use CanneryWeb.ConnCase, async: true
|
||||||
alias Cannery.Accounts
|
alias Cannery.Accounts
|
||||||
alias CanneryWeb.UserAuth
|
alias CanneryWeb.UserAuth
|
||||||
import Cannery.AccountsFixtures
|
|
||||||
|
|
||||||
|
@moduletag :user_auth_test
|
||||||
@remember_me_cookie "_cannery_web_user_remember_me"
|
@remember_me_cookie "_cannery_web_user_remember_me"
|
||||||
|
|
||||||
setup %{conn: conn} do
|
setup %{conn: conn} do
|
||||||
@ -140,7 +143,7 @@ defmodule CanneryWeb.UserAuthTest do
|
|||||||
|
|
||||||
test "stores the path to redirect to on GET", %{conn: conn} do
|
test "stores the path to redirect to on GET", %{conn: conn} do
|
||||||
halted_conn =
|
halted_conn =
|
||||||
%{conn | request_path: "/foo", query_string: ""}
|
%{conn | path_info: ["foo"], query_string: ""}
|
||||||
|> fetch_flash()
|
|> fetch_flash()
|
||||||
|> UserAuth.require_authenticated_user([])
|
|> UserAuth.require_authenticated_user([])
|
||||||
|
|
||||||
@ -148,7 +151,7 @@ defmodule CanneryWeb.UserAuthTest do
|
|||||||
assert get_session(halted_conn, :user_return_to) == "/foo"
|
assert get_session(halted_conn, :user_return_to) == "/foo"
|
||||||
|
|
||||||
halted_conn =
|
halted_conn =
|
||||||
%{conn | request_path: "/foo", query_string: "bar=baz"}
|
%{conn | path_info: ["foo"], query_string: "bar=baz"}
|
||||||
|> fetch_flash()
|
|> fetch_flash()
|
||||||
|> UserAuth.require_authenticated_user([])
|
|> UserAuth.require_authenticated_user([])
|
||||||
|
|
||||||
@ -156,7 +159,7 @@ defmodule CanneryWeb.UserAuthTest do
|
|||||||
assert get_session(halted_conn, :user_return_to) == "/foo?bar=baz"
|
assert get_session(halted_conn, :user_return_to) == "/foo?bar=baz"
|
||||||
|
|
||||||
halted_conn =
|
halted_conn =
|
||||||
%{conn | request_path: "/foo?bar", method: "POST"}
|
%{conn | path_info: ["/foo?bar"], method: "POST"}
|
||||||
|> fetch_flash()
|
|> fetch_flash()
|
||||||
|> UserAuth.require_authenticated_user([])
|
|> UserAuth.require_authenticated_user([])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user