diff options
author | rinpatch <rinpatch@sdf.org> | 2020-04-16 21:28:52 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-04-16 21:28:52 +0300 |
commit | 942d7467ca28c898f914539ae85ea3044c36ebbc (patch) | |
tree | 03d909dfcf5974838919076c6ae994515b0c1f84 /test/web/mastodon_api/controllers/timeline_controller_test.exs | |
parent | e89078ac2a27bb0a833c982dbb5eef63ddea3cc0 (diff) | |
parent | 252528a4b9ca3a5d92f1676c44989ad7d8777de1 (diff) | |
download | pleroma-942d7467ca28c898f914539ae85ea3044c36ebbc.tar.gz pleroma-942d7467ca28c898f914539ae85ea3044c36ebbc.zip |
Merge branch 'develop' into features/remove-user-source_data
Diffstat (limited to 'test/web/mastodon_api/controllers/timeline_controller_test.exs')
-rw-r--r-- | test/web/mastodon_api/controllers/timeline_controller_test.exs | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/test/web/mastodon_api/controllers/timeline_controller_test.exs b/test/web/mastodon_api/controllers/timeline_controller_test.exs index 97b1c3e66..06efdc901 100644 --- a/test/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/web/mastodon_api/controllers/timeline_controller_test.exs @@ -20,7 +20,30 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do describe "home" do setup do: oauth_access(["read:statuses"]) + test "does NOT render account/pleroma/relationship if this is disabled by default", %{ + user: user, + conn: conn + } do + clear_config([:extensions, :output_relationships_in_statuses_by_default], false) + + other_user = insert(:user) + + {:ok, _} = CommonAPI.post(other_user, %{"status" => "hi @#{user.nickname}"}) + + response = + conn + |> assign(:user, user) + |> get("/api/v1/timelines/home") + |> json_response(200) + + assert Enum.all?(response, fn n -> + get_in(n, ["account", "pleroma", "relationship"]) == %{} + end) + end + test "the home timeline", %{user: user, conn: conn} do + uri = "/api/v1/timelines/home?with_relationships=true" + following = insert(:user, nickname: "followed") third_user = insert(:user, nickname: "repeated") @@ -28,13 +51,13 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do {:ok, activity} = CommonAPI.post(third_user, %{"status" => "repeated post"}) {:ok, _, _} = CommonAPI.repeat(activity.id, following) - ret_conn = get(conn, "/api/v1/timelines/home") + ret_conn = get(conn, uri) assert Enum.empty?(json_response(ret_conn, :ok)) {:ok, _user} = User.follow(user, following) - ret_conn = get(conn, "/api/v1/timelines/home") + ret_conn = get(conn, uri) assert [ %{ @@ -59,7 +82,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do {:ok, _user} = User.follow(third_user, user) - ret_conn = get(conn, "/api/v1/timelines/home") + ret_conn = get(conn, uri) assert [ %{ |