projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
AP C2S: Restrict creation to `Note`s for now.
[akkoma]
/
test
/
web
/
activity_pub
/
side_effects_test.exs
diff --git
a/test/web/activity_pub/side_effects_test.exs
b/test/web/activity_pub/side_effects_test.exs
index 9d99e05a0cb7385879e17250919a292e12175ea0..0b6b551564723da5d3869fe1be0ca053f68d80c8 100644
(file)
--- a/
test/web/activity_pub/side_effects_test.exs
+++ b/
test/web/activity_pub/side_effects_test.exs
@@
-1,26
+1,30
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
use Pleroma.DataCase
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
use Pleroma.DataCase
+
+ alias Pleroma.Notification
alias Pleroma.Object
alias Pleroma.Object
- alias Pleroma.Web.CommonAPI
- alias Pleroma.Web.ActivityPub.Builder
+ alias Pleroma.Repo
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.ActivityPub
+ alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.SideEffects
alias Pleroma.Web.ActivityPub.SideEffects
+ alias Pleroma.Web.CommonAPI
import Pleroma.Factory
describe "like objects" do
setup do
import Pleroma.Factory
describe "like objects" do
setup do
+ poster = insert(:user)
user = insert(:user)
user = insert(:user)
- {:ok, post} = CommonAPI.post(
us
er, %{"status" => "hey"})
+ {:ok, post} = CommonAPI.post(
post
er, %{"status" => "hey"})
{:ok, like_data, _meta} = Builder.like(user, post.object)
{:ok, like_data, _meta} = Builder.like(user, post.object)
- {:ok, like, _meta} = ActivityPub.persist(like_data,
[]
)
+ {:ok, like, _meta} = ActivityPub.persist(like_data,
local: true
)
- %{like: like, user: user}
+ %{like: like, user: user
, poster: poster
}
end
test "add the like to the original object", %{like: like, user: user} do
end
test "add the like to the original object", %{like: like, user: user} do
@@
-29,5
+33,10
@@
defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
assert object.data["like_count"] == 1
assert user.ap_id in object.data["likes"]
end
assert object.data["like_count"] == 1
assert user.ap_id in object.data["likes"]
end
+
+ test "creates a notification", %{like: like, poster: poster} do
+ {:ok, like, _} = SideEffects.handle(like)
+ assert Repo.get_by(Notification, user_id: poster.id, activity_id: like.id)
+ end
end
end
end
end