X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Factivity_test.exs;h=46b55beaaac2dac5ef64cb0dedd6e36e80496cbc;hb=37c2deb3ddcd473be9a55bbbd48b370b67a0384a;hp=f9f789a7680da7aa0921fdbc6430054465c734d1;hpb=5bfbad13ad4dd009b172748d81f56ead21c700de;p=akkoma
diff --git a/test/activity_test.exs b/test/activity_test.exs
index f9f789a76..46b55beaa 100644
--- a/test/activity_test.exs
+++ b/test/activity_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.ActivityTest do
@@ -7,6 +7,7 @@ defmodule Pleroma.ActivityTest do
alias Pleroma.Activity
alias Pleroma.Bookmark
alias Pleroma.Object
+ alias Pleroma.Tests.ObanHelpers
alias Pleroma.ThreadMute
import Pleroma.Factory
@@ -125,8 +126,27 @@ defmodule Pleroma.ActivityTest do
}
{:ok, local_activity} = Pleroma.Web.CommonAPI.post(user, %{"status" => "find me!"})
- {:ok, remote_activity} = Pleroma.Web.Federator.incoming_ap_doc(params)
- %{local_activity: local_activity, remote_activity: remote_activity, user: user}
+ {:ok, japanese_activity} = Pleroma.Web.CommonAPI.post(user, %{"status" => "æ´æ°æ
å ±"})
+ {:ok, job} = Pleroma.Web.Federator.incoming_ap_doc(params)
+ {:ok, remote_activity} = ObanHelpers.perform(job)
+
+ %{
+ japanese_activity: japanese_activity,
+ local_activity: local_activity,
+ remote_activity: remote_activity,
+ user: user
+ }
+ end
+
+ clear_config([:instance, :limit_to_local_content])
+
+ test "finds utf8 text in statuses", %{
+ japanese_activity: japanese_activity,
+ user: user
+ } do
+ activities = Activity.search(user, "æ´æ°æ
å ±")
+
+ assert [^japanese_activity] = activities
end
test "find local and remote statuses for authenticated users", %{
@@ -147,7 +167,6 @@ defmodule Pleroma.ActivityTest do
%{local_activity: local_activity} do
Pleroma.Config.put([:instance, :limit_to_local_content], :all)
assert [^local_activity] = Activity.search(nil, "find me")
- Pleroma.Config.put([:instance, :limit_to_local_content], :unauthenticated)
end
test "find all statuses for unauthenticated users when `limit_to_local_content` is `false`",
@@ -160,8 +179,6 @@ defmodule Pleroma.ActivityTest do
activities = Enum.sort_by(Activity.search(nil, "find me"), & &1.id)
assert [^local_activity, ^remote_activity] = activities
-
- Pleroma.Config.put([:instance, :limit_to_local_content], :unauthenticated)
end
end
@@ -213,7 +230,11 @@ defmodule Pleroma.ActivityTest do
assert [] == Activity.all_by_actor_and_id(user, [])
- assert [%Activity{id: ^id2}, %Activity{id: ^id1}] =
- Activity.all_by_actor_and_id(user.ap_id, [id1, id2])
+ activities =
+ user.ap_id
+ |> Activity.all_by_actor_and_id([id1, id2])
+ |> Enum.sort(&(&1.id < &2.id))
+
+ assert [%Activity{id: ^id1}, %Activity{id: ^id2}] = activities
end
end