Rename repository
This commit is contained in:
parent
4aeb2d2cd8
commit
232df26b85
71 changed files with 348 additions and 345 deletions
|
@ -1,5 +1,5 @@
|
|||
defmodule MatrixServerWeb.InfoControllerTest do
|
||||
use MatrixServerWeb.ConnCase
|
||||
defmodule ArchitexWeb.InfoControllerTest do
|
||||
use ArchitexWeb.ConnCase
|
||||
|
||||
test "versions endpoint returns a list of supported Matrix spec versions", %{conn: conn} do
|
||||
conn = get(conn, Routes.info_path(conn, :versions))
|
||||
|
@ -9,7 +9,7 @@ defmodule MatrixServerWeb.InfoControllerTest do
|
|||
end
|
||||
|
||||
test "unrecognized route renders M_UNRECOGNIZED error", %{conn: conn} do
|
||||
conn = get(conn, MatrixServerWeb.Endpoint.url() <> "/sneed")
|
||||
conn = get(conn, ArchitexWeb.Endpoint.url() <> "/sneed")
|
||||
|
||||
assert %{"errcode" => "M_UNRECOGNIZED"} = json_response(conn, 400)
|
||||
end
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
defmodule MatrixServerWeb.LoginControllerTest do
|
||||
use MatrixServerWeb.ConnCase
|
||||
defmodule ArchitexWeb.LoginControllerTest do
|
||||
use ArchitexWeb.ConnCase
|
||||
|
||||
alias MatrixServer.Factory
|
||||
alias MatrixServerWeb.Endpoint
|
||||
alias Architex.Factory
|
||||
alias ArchitexWeb.Endpoint
|
||||
|
||||
@basic_params %{
|
||||
"type" => "m.login.password",
|
||||
|
@ -31,7 +31,7 @@ defmodule MatrixServerWeb.LoginControllerTest do
|
|||
recycle(conn)
|
||||
|> post_json(Routes.login_path(Endpoint, :login), %{
|
||||
@basic_params
|
||||
| "identifier" => %{"type" => "m.id.user", "user" => MatrixServer.get_mxid("sneed")}
|
||||
| "identifier" => %{"type" => "m.id.user", "user" => Architex.get_mxid("sneed")}
|
||||
})
|
||||
|
||||
assert %{"user_id" => _, "access_token" => _, "device_id" => _} = json_response(conn, 200)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
defmodule MatrixServerWeb.RegisterControllerTest do
|
||||
use MatrixServerWeb.ConnCase
|
||||
defmodule ArchitexWeb.RegisterControllerTest do
|
||||
use ArchitexWeb.ConnCase
|
||||
|
||||
import Ecto.Query
|
||||
|
||||
alias MatrixServer.{Repo, Device, Factory}
|
||||
alias MatrixServerWeb.Endpoint
|
||||
alias Architex.{Repo, Device, Factory}
|
||||
alias ArchitexWeb.Endpoint
|
||||
|
||||
@basic_params %{
|
||||
"username" => "user",
|
||||
|
@ -22,7 +22,7 @@ defmodule MatrixServerWeb.RegisterControllerTest do
|
|||
|
||||
test "registers account with minimal information", %{conn: conn} do
|
||||
conn = post_json(conn, Routes.register_path(Endpoint, :register), @basic_params)
|
||||
user_id = MatrixServer.get_mxid("user")
|
||||
user_id = Architex.get_mxid("user")
|
||||
|
||||
assert %{"access_token" => _, "device_id" => _, "user_id" => ^user_id} =
|
||||
json_response(conn, 200)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule MatrixServerWeb.ConnCase do
|
||||
defmodule ArchitexWeb.ConnCase do
|
||||
@moduledoc """
|
||||
This module defines the test case to be used by
|
||||
tests that require setting up a connection.
|
||||
|
@ -11,7 +11,7 @@ defmodule MatrixServerWeb.ConnCase do
|
|||
we enable the SQL sandbox, so changes done to the database
|
||||
are reverted at the end of every test. If you are using
|
||||
PostgreSQL, you can even run database tests asynchronously
|
||||
by setting `use MatrixServerWeb.ConnCase, async: true`, although
|
||||
by setting `use ArchitexWeb.ConnCase, async: true`, although
|
||||
this option is not recommended for other databases.
|
||||
"""
|
||||
|
||||
|
@ -22,20 +22,20 @@ defmodule MatrixServerWeb.ConnCase do
|
|||
# Import conveniences for testing with connections
|
||||
import Plug.Conn
|
||||
import Phoenix.ConnTest
|
||||
import MatrixServerWeb.ConnCase
|
||||
import ArchitexWeb.ConnCase
|
||||
|
||||
alias MatrixServerWeb.Router.Helpers, as: Routes
|
||||
alias ArchitexWeb.Router.Helpers, as: Routes
|
||||
|
||||
# The default endpoint for testing
|
||||
@endpoint MatrixServerWeb.Endpoint
|
||||
@endpoint ArchitexWeb.Endpoint
|
||||
end
|
||||
end
|
||||
|
||||
setup tags do
|
||||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(MatrixServer.Repo)
|
||||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Architex.Repo)
|
||||
|
||||
unless tags[:async] do
|
||||
Ecto.Adapters.SQL.Sandbox.mode(MatrixServer.Repo, {:shared, self()})
|
||||
Ecto.Adapters.SQL.Sandbox.mode(Architex.Repo, {:shared, self()})
|
||||
end
|
||||
|
||||
{:ok, conn: Phoenix.ConnTest.build_conn()}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule MatrixServer.DataCase do
|
||||
defmodule Architex.DataCase do
|
||||
@moduledoc """
|
||||
This module defines the setup for tests requiring
|
||||
access to the application's data layer.
|
||||
|
@ -10,7 +10,7 @@ defmodule MatrixServer.DataCase do
|
|||
we enable the SQL sandbox, so changes done to the database
|
||||
are reverted at the end of every test. If you are using
|
||||
PostgreSQL, you can even run database tests asynchronously
|
||||
by setting `use MatrixServer.DataCase, async: true`, although
|
||||
by setting `use Architex.DataCase, async: true`, although
|
||||
this option is not recommended for other databases.
|
||||
"""
|
||||
|
||||
|
@ -18,20 +18,20 @@ defmodule MatrixServer.DataCase do
|
|||
|
||||
using do
|
||||
quote do
|
||||
alias MatrixServer.Repo
|
||||
alias Architex.Repo
|
||||
|
||||
import Ecto
|
||||
import Ecto.Changeset
|
||||
import Ecto.Query
|
||||
import MatrixServer.DataCase
|
||||
import Architex.DataCase
|
||||
end
|
||||
end
|
||||
|
||||
setup tags do
|
||||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(MatrixServer.Repo)
|
||||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Architex.Repo)
|
||||
|
||||
unless tags[:async] do
|
||||
Ecto.Adapters.SQL.Sandbox.mode(MatrixServer.Repo, {:shared, self()})
|
||||
Ecto.Adapters.SQL.Sandbox.mode(Architex.Repo, {:shared, self()})
|
||||
end
|
||||
|
||||
:ok
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
defmodule MatrixServer.Factory do
|
||||
use ExMachina.Ecto, repo: MatrixServer.Repo
|
||||
defmodule Architex.Factory do
|
||||
use ExMachina.Ecto, repo: Architex.Repo
|
||||
|
||||
alias MatrixServer.{Account, Device}
|
||||
alias Architex.{Account, Device}
|
||||
|
||||
def account_factory do
|
||||
%Account{
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
ExUnit.start()
|
||||
Ecto.Adapters.SQL.Sandbox.mode(MatrixServer.Repo, :manual)
|
||||
Ecto.Adapters.SQL.Sandbox.mode(Architex.Repo, :manual)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue