MastoAPI: Add emoji output.
[akkoma] / test / web / mastodon_api / mastodon_api_controller_test.exs
index 1bef1a1fdc902462f0e60093e2529569cb6c5eb2..56888140de04d61cb44c2424f7b767469f5c4765 100644 (file)
@@ -332,4 +332,30 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
     [status] = results["statuses"]
     assert status["id"] == activity.id
   end
+
+  test "search fetches remote accounts", %{conn: conn} do
+    conn = conn
+    |> get("/api/v1/search", %{"q" => "shp@social.heldscal.la", "resolve" => "true"})
+
+    assert results = json_response(conn, 200)
+    [account] = results["accounts"]
+    assert account["acct"] == "shp@social.heldscal.la"
+  end
+
+  test "returns the favorites of a user", %{conn: conn} do
+    user = insert(:user)
+    other_user = insert(:user)
+
+    {:ok, _} = CommonAPI.post(other_user, %{"status" => "bla"})
+    {:ok, activity} = CommonAPI.post(other_user, %{"status" => "traps are happy"})
+
+    {:ok, _, _} = CommonAPI.favorite(activity.id, user)
+
+    conn = conn
+    |> assign(:user, user)
+    |> get("/api/v1/favourites")
+
+    assert [status] = json_response(conn, 200)
+    assert status["id"] == activity.id
+  end
 end