mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-23 08:22:50 +00:00
a04dfc5293
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
39 lines
1.3 KiB
Elixir
39 lines
1.3 KiB
Elixir
defmodule MobilizonWeb.NodeInfoControllerTest do
|
|
use MobilizonWeb.ConnCase
|
|
|
|
@instance Application.get_env(:mobilizon, :instance)
|
|
|
|
test "Get node info schemas", %{conn: conn} do
|
|
conn = get(conn, node_info_path(conn, :schemas))
|
|
|
|
assert json_response(conn, 200) == %{
|
|
"links" => [
|
|
%{
|
|
"href" =>
|
|
MobilizonWeb.Router.Helpers.node_info_url(
|
|
MobilizonWeb.Endpoint,
|
|
:nodeinfo,
|
|
"2.0"
|
|
),
|
|
"rel" => "http://nodeinfo.diaspora.software/ns/schema/2.0"
|
|
}
|
|
]
|
|
}
|
|
end
|
|
|
|
test "Get node info", %{conn: conn} do
|
|
conn = get(conn, node_info_path(conn, :nodeinfo, "2.0"))
|
|
|
|
resp = json_response(conn, 200)
|
|
|
|
assert resp == %{
|
|
"metadata" => %{"nodeName" => Keyword.get(@instance, :name)},
|
|
"openRegistrations" => Keyword.get(@instance, :registrations_open),
|
|
"protocols" => ["activitypub"],
|
|
"services" => %{"inbound" => [], "outbound" => []},
|
|
"software" => %{"name" => "mobilizon", "version" => Keyword.get(@instance, :version)},
|
|
"usage" => %{"localComments" => 0, "localPosts" => 0, "users" => %{"total" => 0}},
|
|
"version" => "2.0"
|
|
}
|
|
end
|
|
end
|