diff options
author | rinpatch <rinpatch@sdf.org> | 2019-03-29 21:59:04 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-03-29 21:59:04 +0300 |
commit | 1bb4d5d65be725f374e06da88a5e8e826660596b (patch) | |
tree | f466e872bce6699b0529063300b00a18d58c5b98 /test/web | |
parent | a5edc4da6225ff2bf1ea8862b1c857d7e87c920f (diff) | |
download | pleroma-1bb4d5d65be725f374e06da88a5e8e826660596b.tar.gz pleroma-1bb4d5d65be725f374e06da88a5e8e826660596b.zip |
Implement fake status submit
Diffstat (limited to 'test/web')
-rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index d9bcbf5a9..3395c3689 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -143,6 +143,48 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do assert Repo.get(Activity, id) end + test "posting a fake status", %{conn: conn} do + user = insert(:user) + + real_conn = + conn + |> assign(:user, user) + |> post("/api/v1/statuses", %{ + "status" => + "\"Tenshi Eating a Corndog\" is a much discussed concept on /jp/. The significance of it is disputed, so I will focus on one core concept: the symbolism behind it" + }) + + real_status = + json_response(real_conn, 200) + |> Map.put("id", nil) + |> Map.put("url", nil) + |> Map.put("uri", nil) + |> Map.put("created_at", nil) + |> Kernel.put_in(["pleroma", "conversation_id"], nil) + + assert real_status + + fake_conn = + conn + |> assign(:user, user) + |> post("/api/v1/statuses", %{ + "status" => + "\"Tenshi Eating a Corndog\" is a much discussed concept on /jp/. The significance of it is disputed, so I will focus on one core concept: the symbolism behind it", + "fake" => true + }) + + fake_status = + json_response(fake_conn, 200) + |> Map.put("id", nil) + |> Map.put("url", nil) + |> Map.put("uri", nil) + |> Map.put("created_at", nil) + |> Kernel.put_in(["pleroma", "conversation_id"], nil) + + assert fake_status + assert real_status == fake_status + end + test "posting a status with OGP link preview", %{conn: conn} do Pleroma.Config.put([:rich_media, :enabled], true) user = insert(:user) |