Post direct status test
authorcsaurus <csaurus@mailbox.org>
Mon, 14 May 2018 01:21:42 +0000 (21:21 -0400)
committercsaurus <csaurus@mailbox.org>
Mon, 14 May 2018 01:21:42 +0000 (21:21 -0400)
test/web/mastodon_api/mastodon_api_controller_test.exs

index 883ebc61e085cefb37d89f8368c145c78fd6cf16..71a6eed8d6b96d927d19c8ff706bdee414bf7e1c 100644 (file)
@@ -124,6 +124,22 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
     assert Repo.get(Activity, id)
   end
 
+  test "posting a direct status", %{conn: conn} do
+       user1 = insert(:user)
+       user2 = insert(:user)
+       content = "direct cofe @#{user2.nickname}"
+
+       conn =
+         conn
+       |> assign(:user, user1)
+       |> post("api/v1/statuses", %{"status" => content,
+                                                                "visibility" => "direct"})
+
+       assert %{"content" => content, "id" => id, "visibility" => "direct"} =  json_response(conn, 200)
+       assert activity = Repo.get(Activity, id)
+       assert user2.follower_address not in activity.data["to"]
+  end
+
   test "replying to a status", %{conn: conn} do
     user = insert(:user)