test: fix tests using verified routes
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
6000c41364
commit
5fcf3d5267
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
155A1FB53DE39EC8EFCFD7FB94EA823D
|
155A1FB53DE39EC8EFCFD7FB94EA823D
|
||||||
1C29EE70E90ECED01AF28EC58D2575B5
|
1C29EE70E90ECED01AF28EC58D2575B5
|
||||||
|
26ED12A8E03D044BEDC08749BAA5E357
|
||||||
2BB1D36656B423758A470021718FCB09
|
2BB1D36656B423758A470021718FCB09
|
||||||
31CE26BC979C57B9E3CC97B40C290CE5
|
31CE26BC979C57B9E3CC97B40C290CE5
|
||||||
3529E7A4CECC24D02678820E6F521162
|
3529E7A4CECC24D02678820E6F521162
|
||||||
@ -9,7 +10,6 @@
|
|||||||
53CBBEB6243FAF5C37249CBA17DE6F4C
|
53CBBEB6243FAF5C37249CBA17DE6F4C
|
||||||
5BCE3651A03711295046DE48BDFE007E
|
5BCE3651A03711295046DE48BDFE007E
|
||||||
5C4CED447689F00D9D1ACEB9B895ED29
|
5C4CED447689F00D9D1ACEB9B895ED29
|
||||||
90EB7E986B2A3A0C3851B6BF158ECD73
|
|
||||||
94ACF7B17C3FF42F64E57DD1DA936BD8
|
94ACF7B17C3FF42F64E57DD1DA936BD8
|
||||||
A32E125003F1EDFAD95C487C6A969725
|
A32E125003F1EDFAD95C487C6A969725
|
||||||
ACF6272A1DBB3A2ABD96C0C120B5CA69
|
ACF6272A1DBB3A2ABD96C0C120B5CA69
|
||||||
|
@ -84,13 +84,15 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Actors.Actor do
|
|||||||
rel: "alternate",
|
rel: "alternate",
|
||||||
type: "application/atom+xml",
|
type: "application/atom+xml",
|
||||||
title: gettext("%{name}'s feed", name: actor_display_name_escaped(group)) |> HTML.raw(),
|
title: gettext("%{name}'s feed", name: actor_display_name_escaped(group)) |> HTML.raw(),
|
||||||
href: url(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/atom")
|
href:
|
||||||
|
~p"/@#{Actor.preferred_username_and_domain(group)}/feed/atom" |> url() |> URI.decode()
|
||||||
),
|
),
|
||||||
Tag.tag(:link,
|
Tag.tag(:link,
|
||||||
rel: "alternate",
|
rel: "alternate",
|
||||||
type: "text/calendar",
|
type: "text/calendar",
|
||||||
title: gettext("%{name}'s feed", name: actor_display_name_escaped(group)) |> HTML.raw(),
|
title: gettext("%{name}'s feed", name: actor_display_name_escaped(group)) |> HTML.raw(),
|
||||||
href: url(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/ics")
|
href:
|
||||||
|
~p"/@#{Actor.preferred_username_and_domain(group)}/feed/ics" |> url() |> URI.decode()
|
||||||
),
|
),
|
||||||
Tag.tag(:link,
|
Tag.tag(:link,
|
||||||
rel: "alternate",
|
rel: "alternate",
|
||||||
|
@ -111,9 +111,7 @@ defmodule Mobilizon.Web.ApplicationController do
|
|||||||
is_binary(state) and is_binary(scope) do
|
is_binary(state) and is_binary(scope) do
|
||||||
redirect(conn,
|
redirect(conn,
|
||||||
to:
|
to:
|
||||||
url(
|
~p"/oauth/autorize_approve?#{[client_id: client_id, redirect_uri: redirect_uri, scope: scope, state: state]}"
|
||||||
~p"/oauth/authorize?#{[client_id: client_id, redirect_uri: redirect_uri, scope: scope, state: state]}"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
if is_binary(redirect_uri) and valid_uri?(redirect_uri) do
|
if is_binary(redirect_uri) and valid_uri?(redirect_uri) do
|
||||||
|
@ -6,8 +6,7 @@ defmodule Mobilizon.Federation.ActivityPub.UtilsTest do
|
|||||||
alias Mobilizon.Federation.ActivityPub.Utils
|
alias Mobilizon.Federation.ActivityPub.Utils
|
||||||
alias Mobilizon.Federation.ActivityStream.Converter
|
alias Mobilizon.Federation.ActivityStream.Converter
|
||||||
|
|
||||||
alias Mobilizon.Web.Endpoint
|
use Mobilizon.Web, :verified_routes
|
||||||
alias Mobilizon.Web.Router.Helpers, as: Routes
|
|
||||||
|
|
||||||
describe "make" do
|
describe "make" do
|
||||||
test "comment data from struct" do
|
test "comment data from struct" do
|
||||||
|
@ -5,9 +5,8 @@ defmodule Mobilizon.Service.MetadataTest do
|
|||||||
alias Mobilizon.Posts.Post
|
alias Mobilizon.Posts.Post
|
||||||
alias Mobilizon.Service.Metadata
|
alias Mobilizon.Service.Metadata
|
||||||
alias Mobilizon.Tombstone
|
alias Mobilizon.Tombstone
|
||||||
alias Mobilizon.Web.Endpoint
|
|
||||||
alias Mobilizon.Web.JsonLD.ObjectView
|
alias Mobilizon.Web.JsonLD.ObjectView
|
||||||
alias Mobilizon.Web.Router.Helpers, as: Routes
|
use Mobilizon.Web, :verified_routes
|
||||||
use Mobilizon.DataCase
|
use Mobilizon.DataCase
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ defmodule Mobilizon.Service.MetadataTest do
|
|||||||
|
|
||||||
assert group |> Metadata.build_tags() |> Metadata.Utils.stringify_tags() ==
|
assert group |> Metadata.build_tags() |> Metadata.Utils.stringify_tags() ==
|
||||||
String.trim("""
|
String.trim("""
|
||||||
<meta content="#{group.name}" property="og:title"><meta content="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}")}" property="og:url"><meta content="The event organizer didn't add any description." property="og:description"><meta content="profile" property="og:type"><meta content="#{Actor.preferred_username_and_domain(group)}" property="profile:username"><meta content="summary" property="twitter:card"><meta content="@joinmobilizon" property="twitter:site"><meta content="#{group.avatar.url}" property="og:image"><script type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"#{group.name}","position":1}]}</script><script type="application/ld+json">{"@context":"http://schema.org","@type":"Organization","address":{"@type":"PostalAddress","addressCountry":"My Country","addressLocality":"My Locality","addressRegion":"My Region","postalCode":"My Postal Code","streetAddress":"My Street Address"},"image":"#{group.banner.url}","name":"#{group.name}","url":"#{group.url}"}</script><link href="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/atom")}" rel="alternate" title="#{group.name}'s feed" type="application/atom+xml"><link href="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/ics")}" rel="alternate" title="#{group.name}'s feed" type="text/calendar"><link href="#{group.url}" rel="alternate" type="application/activity+json"><link href="#{group.url}" rel="canonical"><meta content="noindex" name="robots">
|
<meta content="#{group.name}" property="og:title"><meta content="#{~p"/@#{Actor.preferred_username_and_domain(group)}" |> url() |> URI.decode()}" property="og:url"><meta content="The event organizer didn't add any description." property="og:description"><meta content="profile" property="og:type"><meta content="#{Actor.preferred_username_and_domain(group)}" property="profile:username"><meta content="summary" property="twitter:card"><meta content="@joinmobilizon" property="twitter:site"><meta content="#{group.avatar.url}" property="og:image"><script type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"#{group.name}","position":1}]}</script><script type="application/ld+json">{"@context":"http://schema.org","@type":"Organization","address":{"@type":"PostalAddress","addressCountry":"My Country","addressLocality":"My Locality","addressRegion":"My Region","postalCode":"My Postal Code","streetAddress":"My Street Address"},"image":"#{group.banner.url}","name":"#{group.name}","url":"#{group.url}"}</script><link href="#{~p"/@#{Actor.preferred_username_and_domain(group)}/feed/atom" |> url() |> URI.decode()}" rel="alternate" title="#{group.name}'s feed" type="application/atom+xml"><link href="#{~p"/@#{Actor.preferred_username_and_domain(group)}/feed/ics" |> url() |> URI.decode()}" rel="alternate" title="#{group.name}'s feed" type="text/calendar"><link href="#{group.url}" rel="alternate" type="application/activity+json"><link href="#{group.url}" rel="canonical"><meta content="noindex" name="robots">
|
||||||
""")
|
""")
|
||||||
|
|
||||||
assert group
|
assert group
|
||||||
@ -26,7 +25,7 @@ defmodule Mobilizon.Service.MetadataTest do
|
|||||||
|> Metadata.build_tags()
|
|> Metadata.build_tags()
|
||||||
|> Metadata.Utils.stringify_tags() ==
|
|> Metadata.Utils.stringify_tags() ==
|
||||||
String.trim("""
|
String.trim("""
|
||||||
<meta content="#{group.name}" property="og:title"><meta content="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}")}" property="og:url"><meta content="The event organizer didn't add any description." property="og:description"><meta content="profile" property="og:type"><meta content="#{Actor.preferred_username_and_domain(group)}" property="profile:username"><meta content="summary" property="twitter:card"><meta content="@joinmobilizon" property="twitter:site"><script type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"#{group.name}","position":1}]}</script><script type="application/ld+json">{"@context":"http://schema.org","@type":"Organization","address":{"@type":"PostalAddress","addressCountry":"My Country","addressLocality":"My Locality","addressRegion":"My Region","postalCode":"My Postal Code","streetAddress":"My Street Address"},"image":"#{group.banner.url}","name":"#{group.name}","url":"#{group.url}"}</script><link href="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/atom")}" rel="alternate" title="#{group.name}'s feed" type="application/atom+xml"><link href="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/ics")}" rel="alternate" title="#{group.name}'s feed" type="text/calendar"><link href="#{group.url}" rel="alternate" type="application/activity+json"><link href="#{group.url}" rel="canonical"><meta content="noindex" name="robots">
|
<meta content="#{group.name}" property="og:title"><meta content="#{~p"/@#{Actor.preferred_username_and_domain(group)}" |> url() |> URI.decode()}" property="og:url"><meta content="The event organizer didn't add any description." property="og:description"><meta content="profile" property="og:type"><meta content="#{Actor.preferred_username_and_domain(group)}" property="profile:username"><meta content="summary" property="twitter:card"><meta content="@joinmobilizon" property="twitter:site"><script type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"#{group.name}","position":1}]}</script><script type="application/ld+json">{"@context":"http://schema.org","@type":"Organization","address":{"@type":"PostalAddress","addressCountry":"My Country","addressLocality":"My Locality","addressRegion":"My Region","postalCode":"My Postal Code","streetAddress":"My Street Address"},"image":"#{group.banner.url}","name":"#{group.name}","url":"#{group.url}"}</script><link href="#{~p"/@#{Actor.preferred_username_and_domain(group)}/feed/atom" |> url() |> URI.decode()}" rel="alternate" title="#{group.name}'s feed" type="application/atom+xml"><link href="#{~p"/@#{Actor.preferred_username_and_domain(group)}/feed/ics" |> url() |> URI.decode()}" rel="alternate" title="#{group.name}'s feed" type="text/calendar"><link href="#{group.url}" rel="alternate" type="application/activity+json"><link href="#{group.url}" rel="canonical"><meta content="noindex" name="robots">
|
||||||
""")
|
""")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -27,8 +27,6 @@ defmodule Mobilizon.Web.ConnCase do
|
|||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
import Phoenix.ConnTest
|
import Phoenix.ConnTest
|
||||||
|
|
||||||
import Mobilizon.Web.Router.Helpers
|
|
||||||
|
|
||||||
use Mobilizon.Web, :verified_routes
|
use Mobilizon.Web, :verified_routes
|
||||||
|
|
||||||
# The default endpoint for testing
|
# The default endpoint for testing
|
||||||
|
@ -18,7 +18,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
|
|||||||
alias Mobilizon.Service.HTTP.ActivityPub.Mock
|
alias Mobilizon.Service.HTTP.ActivityPub.Mock
|
||||||
alias Mobilizon.Web.ActivityPub.ActorView
|
alias Mobilizon.Web.ActivityPub.ActorView
|
||||||
alias Mobilizon.Web.{Endpoint, PageView}
|
alias Mobilizon.Web.{Endpoint, PageView}
|
||||||
alias Mobilizon.Web.Router.Helpers, as: Routes
|
use Mobilizon.Web, :verified_routes
|
||||||
|
|
||||||
setup_all do
|
setup_all do
|
||||||
Mobilizon.Config.put([:instance, :federating], true)
|
Mobilizon.Config.put([:instance, :federating], true)
|
||||||
@ -412,7 +412,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
|
|||||||
test "with the relay active, it returns the relay user", %{conn: conn} do
|
test "with the relay active, it returns the relay user", %{conn: conn} do
|
||||||
res =
|
res =
|
||||||
conn
|
conn
|
||||||
|> get(activity_pub_path(conn, :relay))
|
|> get(url(~p"/relay"))
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
assert res["id"] =~ "/relay"
|
assert res["id"] =~ "/relay"
|
||||||
@ -422,7 +422,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
|
|||||||
Config.put([:instance, :allow_relay], false)
|
Config.put([:instance, :allow_relay], false)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> get(activity_pub_path(conn, :relay))
|
|> get(url(~p"/relay"))
|
||||||
|> json_response(404)
|
|> json_response(404)
|
||||||
|> assert
|
|> assert
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
defmodule Mobilizon.Web.ApplicationControllerTest do
|
defmodule Mobilizon.Web.ApplicationControllerTest do
|
||||||
use Mobilizon.Web.ConnCase
|
use Mobilizon.Web.ConnCase
|
||||||
alias Mobilizon.Service.Auth.Applications
|
alias Mobilizon.Service.Auth.Applications
|
||||||
alias Mobilizon.Web.Router.Helpers, as: Routes
|
use Mobilizon.Web, :verified_routes
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
|
||||||
describe "create application" do
|
describe "create application" do
|
||||||
@ -74,7 +74,9 @@ defmodule Mobilizon.Web.ApplicationControllerTest do
|
|||||||
conn =
|
conn =
|
||||||
get(
|
get(
|
||||||
conn,
|
conn,
|
||||||
"/oauth/authorize?client_id=hello&redirect_uri=#{URI.encode("https://somewhere.org/callback")}"
|
url(
|
||||||
|
~p"/oauth/authorize?client_id=hello&redirect_uri=#{URI.encode("https://somewhere.org/callback")}"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
assert redirected_to(conn) =~
|
assert redirected_to(conn) =~
|
||||||
@ -85,7 +87,9 @@ defmodule Mobilizon.Web.ApplicationControllerTest do
|
|||||||
conn =
|
conn =
|
||||||
get(
|
get(
|
||||||
conn,
|
conn,
|
||||||
"/oauth/authorize?client_id=hello&redirect_uri=#{URI.encode("https://somewhere.org/callback&state=something&scope=everything")}"
|
url(
|
||||||
|
~p"/oauth/authorize?client_id=hello&scope=everything&state=something&redirect_uri=#{URI.encode("https://somewhere.org/callback")}"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
assert redirected_to(conn) =~ "/oauth/autorize_approve"
|
assert redirected_to(conn) =~ "/oauth/autorize_approve"
|
||||||
|
@ -4,8 +4,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
|
|||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
|
||||||
alias Mobilizon.Config
|
alias Mobilizon.Config
|
||||||
alias Mobilizon.Web.Endpoint
|
use Mobilizon.Web, :verified_routes
|
||||||
alias Mobilizon.Web.Router.Helpers, as: Routes
|
|
||||||
|
|
||||||
describe "/@:preferred_username/feed/atom" do
|
describe "/@:preferred_username/feed/atom" do
|
||||||
test "it returns an RSS representation of the actor's public events if the actor is publicly visible",
|
test "it returns an RSS representation of the actor's public events if the actor is publicly visible",
|
||||||
@ -24,11 +23,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
|
|||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> get(
|
|> get(URI.decode(~p"/@#{actor.preferred_username}/feed/atom"))
|
||||||
Endpoint
|
|
||||||
|> ~p"/@#{actor.preferred_username}/feed/atom"
|
|
||||||
|> URI.decode()
|
|
||||||
)
|
|
||||||
|
|
||||||
assert response(conn, 200) =~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
assert response(conn, 200) =~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||||
assert response_content_type(conn, :xml) =~ "charset=utf-8"
|
assert response_content_type(conn, :xml) =~ "charset=utf-8"
|
||||||
@ -62,8 +57,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
|
|||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> get(
|
|> get(
|
||||||
Endpoint
|
~p"/@#{actor.preferred_username}/feed/atom"
|
||||||
|> ~p"/@#{actor.preferred_username}/feed/atom"
|
|
||||||
|> URI.decode()
|
|> URI.decode()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -78,8 +72,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
|
|||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/atom+xml")
|
|> put_req_header("accept", "application/atom+xml")
|
||||||
|> get(
|
|> get(
|
||||||
Endpoint
|
~p"/@#{actor.preferred_username}/feed/atom"
|
||||||
|> ~p"/@#{actor.preferred_username}/feed/atom"
|
|
||||||
|> URI.decode()
|
|> URI.decode()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -196,8 +189,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
|
|||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> get(
|
|> get(
|
||||||
Endpoint
|
~p"/events/#{event1.uuid}/export/ics"
|
||||||
|> ~p"/events/#{event1.uuid}/export/ics"
|
|
||||||
|> URI.decode()
|
|> URI.decode()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -229,7 +221,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
|
|||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}", "atom"))
|
|> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}/atom"))
|
||||||
|
|
||||||
assert response(conn, 200) =~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
assert response(conn, 200) =~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||||
assert response_content_type(conn, :xml) =~ "charset=utf-8"
|
assert response_content_type(conn, :xml) =~ "charset=utf-8"
|
||||||
@ -263,7 +255,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
|
|||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/atom+xml")
|
|> put_req_header("accept", "application/atom+xml")
|
||||||
|> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}", "atom"))
|
|> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}/atom"))
|
||||||
|
|
||||||
assert response(conn, 200) =~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
assert response(conn, 200) =~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||||
assert response_content_type(conn, :xml) =~ "charset=utf-8"
|
assert response_content_type(conn, :xml) =~ "charset=utf-8"
|
||||||
@ -305,7 +297,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
|
|||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "text/calendar")
|
|> put_req_header("accept", "text/calendar")
|
||||||
|> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}", "ics"))
|
|> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}/ics"))
|
||||||
|
|
||||||
assert response(conn, 200) =~ "BEGIN:VCALENDAR"
|
assert response(conn, 200) =~ "BEGIN:VCALENDAR"
|
||||||
assert response_content_type(conn, :calendar) =~ "charset=utf-8"
|
assert response_content_type(conn, :calendar) =~ "charset=utf-8"
|
||||||
@ -335,7 +327,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
|
|||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "text/calendar")
|
|> put_req_header("accept", "text/calendar")
|
||||||
|> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}", "ics"))
|
|> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}/ics"))
|
||||||
|
|
||||||
assert response(conn, 200) =~ "BEGIN:VCALENDAR"
|
assert response(conn, 200) =~ "BEGIN:VCALENDAR"
|
||||||
assert response_content_type(conn, :calendar) =~ "charset=utf-8"
|
assert response_content_type(conn, :calendar) =~ "charset=utf-8"
|
||||||
@ -350,8 +342,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
|
|||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> get(
|
|> get(
|
||||||
Endpoint
|
~p"/events/going/not_existing/ics"
|
||||||
|> ~p"/events/going/not_existing/ics"
|
|
||||||
|> URI.decode()
|
|> URI.decode()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -3,20 +3,19 @@ defmodule Mobilizon.Web.NodeInfoControllerTest do
|
|||||||
|
|
||||||
alias Mobilizon.Config
|
alias Mobilizon.Config
|
||||||
|
|
||||||
alias Mobilizon.Web.Endpoint
|
use Mobilizon.Web, :verified_routes
|
||||||
alias Mobilizon.Web.Router.Helpers, as: Routes
|
|
||||||
|
|
||||||
test "Get node info schemas", %{conn: conn} do
|
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) == %{
|
assert json_response(conn, 200) == %{
|
||||||
"links" => [
|
"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"
|
"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"
|
"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
|
test "Get node info", %{conn: conn} do
|
||||||
# We clear the cache because it might have been initialized by other tests
|
# We clear the cache because it might have been initialized by other tests
|
||||||
Cachex.clear(:statistics)
|
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)
|
resp = json_response(conn, 200)
|
||||||
|
|
||||||
assert resp == %{
|
assert resp == %{
|
||||||
@ -48,7 +47,7 @@ defmodule Mobilizon.Web.NodeInfoControllerTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "Get node info with non supported version (1.0)", %{conn: conn} do
|
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"}
|
assert json_response(conn, 404) == %{"error" => "Nodeinfo schema version not handled"}
|
||||||
end
|
end
|
||||||
|
@ -5,8 +5,7 @@ defmodule Mobilizon.Web.PageControllerTest do
|
|||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Service.ActorSuspension
|
alias Mobilizon.Service.ActorSuspension
|
||||||
alias Mobilizon.Web.Endpoint
|
use Mobilizon.Web, :verified_routes
|
||||||
alias Mobilizon.Web.Router.Helpers, as: Routes
|
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
conn = build_conn() |> put_req_header("accept", "text/html")
|
conn = build_conn() |> put_req_header("accept", "text/html")
|
||||||
|
Loading…
Reference in New Issue
Block a user