2018-11-06 10:30:27 +01:00
|
|
|
defmodule MobilizonWeb.NodeInfoControllerTest do
|
2018-10-11 17:37:39 +02:00
|
|
|
use MobilizonWeb.ConnCase
|
2018-08-01 14:45:18 +02:00
|
|
|
|
2018-10-11 17:37:39 +02:00
|
|
|
@instance Application.get_env(:mobilizon, :instance)
|
2018-08-01 14:45:18 +02:00
|
|
|
|
|
|
|
test "Get node info schemas", %{conn: conn} do
|
2018-11-06 10:30:27 +01:00
|
|
|
conn = get(conn, node_info_path(conn, :schemas))
|
2018-08-01 14:45:18 +02:00
|
|
|
|
|
|
|
assert json_response(conn, 200) == %{
|
|
|
|
"links" => [
|
|
|
|
%{
|
2018-09-03 17:53:31 +02:00
|
|
|
"href" =>
|
2018-11-06 10:30:27 +01:00
|
|
|
MobilizonWeb.Router.Helpers.node_info_url(
|
2018-10-11 17:47:02 +02:00
|
|
|
MobilizonWeb.Endpoint,
|
|
|
|
:nodeinfo,
|
|
|
|
"2.0"
|
|
|
|
),
|
2018-08-01 14:45:18 +02:00
|
|
|
"rel" => "http://nodeinfo.diaspora.software/ns/schema/2.0"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
test "Get node info", %{conn: conn} do
|
2018-11-06 10:30:27 +01:00
|
|
|
conn = get(conn, node_info_path(conn, :nodeinfo, "2.0"))
|
2018-08-01 14:45:18 +02:00
|
|
|
|
|
|
|
resp = json_response(conn, 200)
|
|
|
|
|
|
|
|
assert resp = %{
|
|
|
|
"metadata" => %{"nodeName" => Keyword.get(@instance, :name)},
|
|
|
|
"openRegistrations" => Keyword.get(@instance, :registrations_open),
|
|
|
|
"protocols" => ["activitypub"],
|
|
|
|
"services" => %{"inbound" => [], "outbound" => []},
|
2018-10-11 17:37:39 +02:00
|
|
|
"software" => %{"name" => "mobilizon", "version" => Keyword.get(@instance, :version)},
|
2018-08-01 14:45:18 +02:00
|
|
|
"version" => "2.0"
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|