test: fix tests using verified routes

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2023-12-01 12:06:18 +01:00
parent 6000c41364
commit 5fcf3d5267
11 changed files with 37 additions and 48 deletions

View File

@@ -3,20 +3,19 @@ defmodule Mobilizon.Web.NodeInfoControllerTest do
alias Mobilizon.Config
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
test "Get node info schemas", %{conn: conn} do
conn = get(conn, node_info_path(conn, :schemas))
conn = get(conn, url(~p"/.well-known/nodeinfo"))
assert json_response(conn, 200) == %{
"links" => [
%{
"href" => ~p"/.well-known/nodeinfo/2.0Ã",
"href" => url(~p"/.well-known/nodeinfo/2.0"),
"rel" => "http://nodeinfo.diaspora.software/ns/schema/2.0"
},
%{
"href" => ~p"/.well-known/nodeinfo/2.1",
"href" => url(~p"/.well-known/nodeinfo/2.1"),
"rel" => "http://nodeinfo.diaspora.software/ns/schema/2.1"
}
]
@@ -26,7 +25,7 @@ defmodule Mobilizon.Web.NodeInfoControllerTest do
test "Get node info", %{conn: conn} do
# We clear the cache because it might have been initialized by other tests
Cachex.clear(:statistics)
conn = get(conn, node_info_path(conn, :nodeinfo, "2.1"))
conn = get(conn, url(~p"/.well-known/nodeinfo/2.1"))
resp = json_response(conn, 200)
assert resp == %{
@@ -48,7 +47,7 @@ defmodule Mobilizon.Web.NodeInfoControllerTest do
end
test "Get node info with non supported version (1.0)", %{conn: conn} do
conn = get(conn, node_info_path(conn, :nodeinfo, "1.0"))
conn = get(conn, url(~p"/.well-known/nodeinfo/1.0"))
assert json_response(conn, 404) == %{"error" => "Nodeinfo schema version not handled"}
end