Add unreblogging tests
[akkoma] / test / web / mastodon_api / mastodon_api_controller_test.exs
index 5293b9364ee375441a130f0f121e22c5c1718a87..f3a9c1def1d2f20158224c43e9f9e102ab7553f0 100644 (file)
@@ -264,6 +264,25 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
     end
   end
 
+  describe "unreblogging" do
+    test "unreblogs and returns the unreblogged status", %{conn: conn} do
+      activity = insert(:note_activity)
+      user = insert(:user)
+
+      {:ok, _, _} = CommonAPI.repeat(activity.id, user)
+
+      conn =
+        conn
+        |> assign(:user, user)
+        |> post("/api/v1/statuses/#{activity.id}/unreblog")
+
+      assert %{"reblog" => %{"id" => id, "reblogged" => false, "reblogs_count" => 0}} =
+               json_response(conn, 200)
+
+      assert to_string(activity.id) == id
+    end
+  end
+
   describe "favoriting" do
     test "favs a status and returns it", %{conn: conn} do
       activity = insert(:note_activity)