:ok
end
- clear_config([:instance, :federating]) do
- Config.put([:instance, :federating], true)
- end
+ setup do: clear_config([:instance, :federating], true)
describe "/relay" do
- clear_config([:instance, :allow_relay])
+ setup do: clear_config([:instance, :allow_relay])
test "with the relay active, it returns the relay user", %{conn: conn} do
res =
|> json_response(403)
end
- clear_config([:media_proxy])
- clear_config([Pleroma.Upload])
+ setup do: clear_config([:media_proxy])
+ setup do: clear_config([Pleroma.Upload])
test "POST /api/ap/upload_media", %{conn: conn} do
user = insert(:user)
assert object["name"] == desc
assert object["type"] == "Document"
assert object["actor"] == user.ap_id
- assert [%{"href" => object_href}] = object["url"]
+ assert [%{"href" => object_href, "mediaType" => object_mediatype}] = object["url"]
+ assert is_binary(object_href)
+ assert object_mediatype == "image/jpeg"
activity_request = %{
"@context" => "https://www.w3.org/ns/activitystreams",
assert activity_response["object"]
assert activity_response["actor"] == user.ap_id
- assert %Object{data: %{"attachment" => [attachment]}} = Object.normalize(activity_response["object"])
+ assert %Object{data: %{"attachment" => [attachment]}} =
+ Object.normalize(activity_response["object"])
+
assert attachment["type"] == "Document"
assert attachment["name"] == desc
- assert [%{"href" => attachment_href}] = attachment["url"]
- assert attachment_href == object_href
+
+ assert [
+ %{
+ "href" => ^object_href,
+ "type" => "Link",
+ "mediaType" => ^object_mediatype
+ }
+ ] = attachment["url"]
# Fails if unauthenticated
conn