Merge branch 'mastoapi-non-html-strings' into 'develop'
[akkoma] / test / web / common_api / common_api_test.exs
index f8963e42e90a9c41666fc78f4f0905b27e736310..214cbdd7cee31423970fb1ba904dc88cf65bcb8a 100644 (file)
@@ -238,7 +238,9 @@ defmodule Pleroma.Web.CommonAPITest do
       assert reaction.data["actor"] == user.ap_id
       assert reaction.data["content"] == "👍"
 
-      # TODO: test error case.
+      {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
+
+      {:error, _} = CommonAPI.react_with_emoji(activity.id, user, ".")
     end
 
     test "unreacting to a status with an emoji" do
@@ -322,6 +324,21 @@ defmodule Pleroma.Web.CommonAPITest do
       assert %User{pinned_activities: [^id]} = user
     end
 
+    test "pin poll", %{user: user} do
+      {:ok, activity} =
+        CommonAPI.post(user, %{
+          "status" => "How is fediverse today?",
+          "poll" => %{"options" => ["Absolutely outstanding", "Not good"], "expires_in" => 20}
+        })
+
+      assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
+
+      id = activity.id
+      user = refresh_record(user)
+
+      assert %User{pinned_activities: [^id]} = user
+    end
+
     test "unlisted statuses can be pinned", %{user: user} do
       {:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!", "visibility" => "unlisted"})
       assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)