summaryrefslogtreecommitdiff
path: root/test/support/conn_case.ex
diff options
context:
space:
mode:
authorPierre de Lacroix <pierre@pdelacroix.com>2020-10-19 20:01:38 +0200
committerPierre de Lacroix <pierre@pdelacroix.com>2020-10-19 20:01:38 +0200
commit118649055fae9a6041b6f07ab5485187593da3c7 (patch)
tree584a3f3100dc76bb9f7a58e4330d5a866c784d68 /test/support/conn_case.ex
parentMerge branch 'test-ci' into 'master' (diff)
test: add tests for controllers
Diffstat (limited to 'test/support/conn_case.ex')
-rw-r--r--test/support/conn_case.ex17
1 files changed, 13 insertions, 4 deletions
diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex
index 478e03f..bc28d10 100644
--- a/test/support/conn_case.ex
+++ b/test/support/conn_case.ex
@@ -24,14 +24,23 @@ defmodule MatrixAppServiceWeb.ConnCase do
import Phoenix.ConnTest
import MatrixAppServiceWeb.ConnCase
- alias MatrixAppServiceWeb.Router.Helpers, as: Routes
+ alias MatrixAppServiceWeb.TestRouter.Helpers, as: Routes
# The default endpoint for testing
- @endpoint MatrixAppServiceWeb.Endpoint
+ @endpoint MatrixAppServiceWeb.TestEndpoint
end
end
- setup _tags do
- {:ok, conn: Phoenix.ConnTest.build_conn()}
+ setup tags do
+ conn =
+ if tags[:authenticated] do
+ Phoenix.ConnTest.build_conn(:get, "/", %{
+ "access_token" => Application.fetch_env!(:matrix_app_service, :homeserver_token)
+ })
+ else
+ Phoenix.ConnTest.build_conn()
+ end
+
+ {:ok, conn: conn}
end
end