projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Transmogrifier: Use new ingestion pipeline for Likes.
[akkoma]
/
test
/
notification_test.exs
diff --git
a/test/notification_test.exs
b/test/notification_test.exs
index 2a52dad8d87f9a344d74a8a89c5e234cee5c6b73..940913aa61bdc448d82f7efebfce36aa8a715b99 100644
(file)
--- a/
test/notification_test.exs
+++ b/
test/notification_test.exs
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-201
8
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-201
9
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.NotificationTest do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.NotificationTest do
@@
-8,6
+8,7
@@
defmodule Pleroma.NotificationTest do
import Pleroma.Factory
alias Pleroma.Notification
import Pleroma.Factory
alias Pleroma.Notification
+ alias Pleroma.Tests.ObanHelpers
alias Pleroma.User
alias Pleroma.Web.ActivityPub.Transmogrifier
alias Pleroma.Web.CommonAPI
alias Pleroma.User
alias Pleroma.Web.ActivityPub.Transmogrifier
alias Pleroma.Web.CommonAPI
@@
-68,16
+69,7
@@
defmodule Pleroma.NotificationTest do
end
describe "create_notification" do
end
describe "create_notification" do
- setup do
- GenServer.start(Streamer, %{}, name: Streamer)
-
- on_exit(fn ->
- if pid = Process.whereis(Streamer) do
- Process.exit(pid, :kill)
- end
- end)
- end
-
+ @tag needs_streamer: true
test "it creates a notification for user and send to the 'user' and the 'user:notification' stream" do
user = insert(:user)
task = Task.async(fn -> assert_receive {:text, _}, 4_000 end)
test "it creates a notification for user and send to the 'user' and the 'user:notification' stream" do
user = insert(:user)
task = Task.async(fn -> assert_receive {:text, _}, 4_000 end)
@@
-439,7
+431,7
@@
defmodule Pleroma.NotificationTest do
"status" => "hey @#{other_user.nickname}!"
})
"status" => "hey @#{other_user.nickname}!"
})
- {:ok, activity_two
, _} = CommonAPI.favorite(activity_one.id, third_user
)
+ {:ok, activity_two
} = CommonAPI.favorite(third_user, activity_one.id
)
assert other_user not in Notification.get_notified_from_activity(activity_two)
end
assert other_user not in Notification.get_notified_from_activity(activity_two)
end
@@
-469,7
+461,7
@@
defmodule Pleroma.NotificationTest do
assert Enum.empty?(Notification.for_user(user))
assert Enum.empty?(Notification.for_user(user))
- {:ok, _
, _} = CommonAPI.favorite(activity.id, other_user
)
+ {:ok, _
} = CommonAPI.favorite(other_user, activity.id
)
assert length(Notification.for_user(user)) == 1
assert length(Notification.for_user(user)) == 1
@@
-486,7
+478,7
@@
defmodule Pleroma.NotificationTest do
assert Enum.empty?(Notification.for_user(user))
assert Enum.empty?(Notification.for_user(user))
- {:ok, _
, _} = CommonAPI.favorite(activity.id, other_user
)
+ {:ok, _
} = CommonAPI.favorite(other_user, activity.id
)
assert length(Notification.for_user(user)) == 1
assert length(Notification.for_user(user)) == 1
@@
-541,7
+533,7
@@
defmodule Pleroma.NotificationTest do
assert Enum.empty?(Notification.for_user(user))
assert Enum.empty?(Notification.for_user(user))
- {:error, _} = CommonAPI.favorite(
activity.id, other_user
)
+ {:error, _} = CommonAPI.favorite(
other_user, activity.id
)
assert Enum.empty?(Notification.for_user(user))
end
assert Enum.empty?(Notification.for_user(user))
end
@@
-588,7
+580,8
@@
defmodule Pleroma.NotificationTest do
refute Enum.empty?(Notification.for_user(other_user))
refute Enum.empty?(Notification.for_user(other_user))
- User.delete(user)
+ {:ok, job} = User.delete(user)
+ ObanHelpers.perform(job)
assert Enum.empty?(Notification.for_user(other_user))
end
assert Enum.empty?(Notification.for_user(other_user))
end
@@
-633,6
+626,7
@@
defmodule Pleroma.NotificationTest do
}
{:ok, _delete_activity} = Transmogrifier.handle_incoming(delete_user_message)
}
{:ok, _delete_activity} = Transmogrifier.handle_incoming(delete_user_message)
+ ObanHelpers.perform_all()
assert Enum.empty?(Notification.for_user(local_user))
end
assert Enum.empty?(Notification.for_user(local_user))
end