diff options
| author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-09-26 14:28:35 +0700 | 
|---|---|---|
| committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-09-27 10:52:47 +0700 | 
| commit | 5ea5c58a85b7be56370b151ce8977982d47fde8c (patch) | |
| tree | a48af9bf72549d691386ca01f0be3f1ca8db4926 /test | |
| parent | 76b7e5cd5b34e68055bab7353cb845f3429d897f (diff) | |
| download | pleroma-5ea5c58a85b7be56370b151ce8977982d47fde8c.tar.gz pleroma-5ea5c58a85b7be56370b151ce8977982d47fde8c.zip  | |
Move view logic from StatusController.context to StatusView and add a test
Diffstat (limited to 'test')
| -rw-r--r-- | test/web/mastodon_api/controllers/status_controller_test.exs | 21 | 
1 files changed, 21 insertions, 0 deletions
diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index f80ce7704..14c7bd6d9 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -1053,4 +1053,25 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do        assert [] == response      end    end + +  test "context" do +    user = insert(:user) + +    {:ok, %{id: id1}} = CommonAPI.post(user, %{"status" => "1"}) +    {:ok, %{id: id2}} = CommonAPI.post(user, %{"status" => "2", "in_reply_to_status_id" => id1}) +    {:ok, %{id: id3}} = CommonAPI.post(user, %{"status" => "3", "in_reply_to_status_id" => id2}) +    {:ok, %{id: id4}} = CommonAPI.post(user, %{"status" => "4", "in_reply_to_status_id" => id3}) +    {:ok, %{id: id5}} = CommonAPI.post(user, %{"status" => "5", "in_reply_to_status_id" => id4}) + +    response = +      build_conn() +      |> assign(:user, nil) +      |> get("/api/v1/statuses/#{id3}/context") +      |> json_response(:ok) + +    assert %{ +             "ancestors" => [%{"id" => ^id1}, %{"id" => ^id2}], +             "descendants" => [%{"id" => ^id4}, %{"id" => ^id5}] +           } = response +  end  end  | 
