summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/mastodon_api_controller_test.exs
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-03-29 21:59:04 +0300
committerrinpatch <rinpatch@sdf.org>2019-03-29 21:59:04 +0300
commit1bb4d5d65be725f374e06da88a5e8e826660596b (patch)
treef466e872bce6699b0529063300b00a18d58c5b98 /test/web/mastodon_api/mastodon_api_controller_test.exs
parenta5edc4da6225ff2bf1ea8862b1c857d7e87c920f (diff)
downloadpleroma-1bb4d5d65be725f374e06da88a5e8e826660596b.tar.gz
pleroma-1bb4d5d65be725f374e06da88a5e8e826660596b.zip
Implement fake status submit
Diffstat (limited to 'test/web/mastodon_api/mastodon_api_controller_test.exs')
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs42
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)