diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-05-25 23:27:47 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-05-25 23:27:47 +0300 |
commit | d7a57004ef975e2cf02facb9d80cff287a5d6d3b (patch) | |
tree | 820d469688d868bc7a8b072746953f5be0db105c /test/web/feed | |
parent | 09d8b9cb553dc0d5cf18864ee0d82f099c82e5e9 (diff) | |
download | pleroma-d7a57004ef975e2cf02facb9d80cff287a5d6d3b.tar.gz |
[#1501] Made user feed contain public and unlisted activities.
Diffstat (limited to 'test/web/feed')
-rw-r--r-- | test/web/feed/user_controller_test.exs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/test/web/feed/user_controller_test.exs b/test/web/feed/user_controller_test.exs index 05ad427c2..fa2ed1ea5 100644 --- a/test/web/feed/user_controller_test.exs +++ b/test/web/feed/user_controller_test.exs @@ -11,13 +11,14 @@ defmodule Pleroma.Web.Feed.UserControllerTest do alias Pleroma.Config alias Pleroma.Object alias Pleroma.User + alias Pleroma.Web.CommonAPI setup do: clear_config([:instance, :federating], true) describe "feed" do setup do: clear_config([:feed]) - test "gets a feed", %{conn: conn} do + test "gets an atom feed", %{conn: conn} do Config.put( [:feed, :post_title], %{max_length: 10, omission: "..."} @@ -157,6 +158,29 @@ defmodule Pleroma.Web.Feed.UserControllerTest do assert response(conn, 404) end + + test "returns feed with public and unlisted activities", %{conn: conn} do + user = insert(:user) + + {:ok, _} = CommonAPI.post(user, %{status: "public", visibility: "public"}) + {:ok, _} = CommonAPI.post(user, %{status: "direct", visibility: "direct"}) + {:ok, _} = CommonAPI.post(user, %{status: "unlisted", visibility: "unlisted"}) + {:ok, _} = CommonAPI.post(user, %{status: "private", visibility: "private"}) + + resp = + conn + |> put_req_header("accept", "application/atom+xml") + |> get(user_feed_path(conn, :feed, user.nickname)) + |> response(200) + + activity_titles = + resp + |> SweetXml.parse() + |> SweetXml.xpath(~x"//entry/title/text()"l) + |> Enum.sort() + + assert activity_titles == ['public', 'unlisted'] + end end # Note: see ActivityPubControllerTest for JSON format tests |