X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=test%2Fpleroma%2Fweb%2Fcommon_api_test.exs;h=ad0b8754313cd399bb4b263ab9bafef9d8130448;hb=106b5c26781dd1e92b6cd820b3dff41a27a4c4d2;hp=fa55c2832daf8b5df939cf795b89547683aa924c;hpb=79376b4afb8bba0766cb3d04179aeaf4c0b7000b;p=akkoma diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index fa55c2832..ad0b87543 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -18,6 +18,7 @@ defmodule Pleroma.Web.CommonAPITest do alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.AdminAPI.AccountView alias Pleroma.Web.CommonAPI + alias Pleroma.Workers.PollWorker import Pleroma.Factory import Mock @@ -48,6 +49,12 @@ defmodule Pleroma.Web.CommonAPITest do assert object.data["type"] == "Question" assert object.data["oneOf"] |> length() == 2 + + assert_enqueued( + worker: PollWorker, + args: %{op: "poll_end", activity_id: activity.id}, + scheduled_at: NaiveDateTime.from_iso8601!(object.data["closed"]) + ) end end @@ -202,9 +209,7 @@ defmodule Pleroma.Web.CommonAPITest do object = Object.normalize(activity, fetch: false) assert object.data["content"] == - "https://example.org is the site of @#{other_user.nickname} #2hu" + "https://example.org is the site of @#{other_user.nickname} #2hu" end test "it posts a chat message" do @@ -519,7 +524,7 @@ defmodule Pleroma.Web.CommonAPITest do {:ok, activity} = CommonAPI.post(user, %{status: "hey :blank:"}) assert %{"blank" => url} = Object.normalize(activity).data["emoji"] - assert url == "#{Pleroma.Web.base_url()}/emoji/blank.png" + assert url == "#{Pleroma.Web.Endpoint.url()}/emoji/blank.png" end test "it copies emoji from the subject of the parent post" do @@ -539,8 +544,8 @@ defmodule Pleroma.Web.CommonAPITest do spoiler_text: ":joker_smile:" }) - assert Object.normalize(reply_activity).data["emoji"][":joker_smile:"] - refute Object.normalize(reply_activity).data["emoji"][":joker_disapprove:"] + assert Object.normalize(reply_activity).data["emoji"]["joker_smile"] + refute Object.normalize(reply_activity).data["emoji"]["joker_disapprove"] end test "deactivated users can't post" do @@ -597,7 +602,7 @@ defmodule Pleroma.Web.CommonAPITest do object = Object.normalize(activity, fetch: false) - assert object.data["content"] == "
2hu
alert('xss')" + assert object.data["content"] == "2hu
" assert object.data["source"] == post end