X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fweb%2Ffeed%2Ftag_controller_test.exs;h=140cdb8bf5f5c05b4dcb566d410ab70f7c1ee41f;hb=4a94c9a31ef11f63ea71ad9c1f085c18cf8ef083;hp=868e4096511320a93668f0fbdbf66064e0d1914b;hpb=c3112fd13a6af239b9dff0813e93266ec58f571e;p=akkoma diff --git a/test/pleroma/web/feed/tag_controller_test.exs b/test/pleroma/web/feed/tag_controller_test.exs index 868e40965..140cdb8bf 100644 --- a/test/pleroma/web/feed/tag_controller_test.exs +++ b/test/pleroma/web/feed/tag_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Feed.TagControllerTest do @@ -15,7 +15,7 @@ defmodule Pleroma.Web.Feed.TagControllerTest do setup do: clear_config([:feed]) test "gets a feed (ATOM)", %{conn: conn} do - Pleroma.Config.put( + clear_config( [:feed, :post_title], %{max_length: 25, omission: "..."} ) @@ -23,7 +23,7 @@ defmodule Pleroma.Web.Feed.TagControllerTest do user = insert(:user) {:ok, activity1} = CommonAPI.post(user, %{status: "yeah #PleromaArt"}) - object = Object.normalize(activity1) + object = Object.normalize(activity1, fetch: false) object_data = Map.put(object.data, "attachment", [ @@ -82,7 +82,7 @@ defmodule Pleroma.Web.Feed.TagControllerTest do end test "gets a feed (RSS)", %{conn: conn} do - Pleroma.Config.put( + clear_config( [:feed, :post_title], %{max_length: 25, omission: "..."} ) @@ -90,7 +90,7 @@ defmodule Pleroma.Web.Feed.TagControllerTest do user = insert(:user) {:ok, activity1} = CommonAPI.post(user, %{status: "yeah #PleromaArt"}) - object = Object.normalize(activity1) + object = Object.normalize(activity1, fetch: false) object_data = Map.put(object.data, "attachment", [ @@ -127,10 +127,10 @@ defmodule Pleroma.Web.Feed.TagControllerTest do "These are public toots tagged with #pleromaart. You can interact with them if you have an account anywhere in the fediverse." assert xpath(xml, ~x"//channel/link/text()") == - '#{Pleroma.Web.base_url()}/tags/pleromaart.rss' + '#{Pleroma.Web.Endpoint.url()}/tags/pleromaart.rss' assert xpath(xml, ~x"//channel/webfeeds:logo/text()") == - '#{Pleroma.Web.base_url()}/static/logo.png' + '#{Pleroma.Web.Endpoint.url()}/static/logo.svg' assert xpath(xml, ~x"//channel/item/title/text()"l) == [ '42 This is :moominmamm...', @@ -146,8 +146,8 @@ defmodule Pleroma.Web.Feed.TagControllerTest do "https://peertube.moe/static/webseed/df5f464b-be8d-46fb-ad81-2d4c2d1630e3-480.mp4" ] - obj1 = Object.normalize(activity1) - obj2 = Object.normalize(activity2) + obj1 = Object.normalize(activity1, fetch: false) + obj2 = Object.normalize(activity2, fetch: false) assert xpath(xml, ~x"//channel/item/description/text()"sl) == [ HtmlEntities.decode(FeedView.activity_content(obj2.data)), @@ -157,7 +157,7 @@ defmodule Pleroma.Web.Feed.TagControllerTest do response = conn |> put_req_header("accept", "application/rss+xml") - |> get(tag_feed_path(conn, :feed, "pleromaart")) + |> get(tag_feed_path(conn, :feed, "pleromaart.rss")) |> response(200) xml = parse(response) @@ -183,14 +183,12 @@ defmodule Pleroma.Web.Feed.TagControllerTest do end describe "private instance" do - setup do: clear_config([:instance, :public]) + setup do: clear_config([:instance, :public], false) test "returns 404 for tags feed", %{conn: conn} do - Config.put([:instance, :public], false) - conn |> put_req_header("accept", "application/rss+xml") - |> get(tag_feed_path(conn, :feed, "pleromaart")) + |> get(tag_feed_path(conn, :feed, "pleromaart.rss")) |> response(404) end end