diff options
author | Mark Felder <feld@FreeBSD.org> | 2020-08-31 15:58:21 -0500 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-09-08 20:21:34 +0300 |
commit | a85ed6defbd2cec71d9a5594ef1de18d5333c7c7 (patch) | |
tree | 80897436977229df5fca3057abed7a8059c2d47e /test | |
parent | 44ced17634a9c89b9ff4a47c64805356f7f6401c (diff) | |
download | pleroma-a85ed6defbd2cec71d9a5594ef1de18d5333c7c7.tar.gz |
Do not serve RSS/Atom feeds when instance is private
Diffstat (limited to 'test')
-rw-r--r-- | test/web/feed/tag_controller_test.exs | 13 | ||||
-rw-r--r-- | test/web/feed/user_controller_test.exs | 16 |
2 files changed, 29 insertions, 0 deletions
diff --git a/test/web/feed/tag_controller_test.exs b/test/web/feed/tag_controller_test.exs index 3c29cd94f..868e40965 100644 --- a/test/web/feed/tag_controller_test.exs +++ b/test/web/feed/tag_controller_test.exs @@ -181,4 +181,17 @@ defmodule Pleroma.Web.Feed.TagControllerTest do 'yeah #PleromaArt' ] end + + describe "private instance" do + setup do: clear_config([:instance, :public]) + + 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")) + |> response(404) + end + end end diff --git a/test/web/feed/user_controller_test.exs b/test/web/feed/user_controller_test.exs index 0d2a61967..9a5610baa 100644 --- a/test/web/feed/user_controller_test.exs +++ b/test/web/feed/user_controller_test.exs @@ -246,4 +246,20 @@ defmodule Pleroma.Web.Feed.UserControllerTest do assert response == ~S({"error":"Not found"}) end end + + describe "private instance" do + setup do: clear_config([:instance, :public]) + + test "returns 404 for user feed", %{conn: conn} do + Config.put([:instance, :public], false) + user = insert(:user) + + {:ok, _} = CommonAPI.post(user, %{status: "test"}) + + assert conn + |> put_req_header("accept", "application/atom+xml") + |> get(user_feed_path(conn, :feed, user.nickname)) + |> response(404) + end + end end |