diff options
author | sxsdv1 <sxsdv1@gmail.com> | 2019-01-08 19:22:26 +0100 |
---|---|---|
committer | sxsdv1 <sxsdv1@gmail.com> | 2019-01-12 20:24:35 +0100 |
commit | 36711e1c83bb24a2b104c4a8f384c475c1583638 (patch) | |
tree | 295d9db6151b437f5d2739938fb9415816e08644 /test | |
parent | 1eb7318831e7239ec929457f6298fb05cb461b43 (diff) | |
download | pleroma-36711e1c83bb24a2b104c4a8f384c475c1583638.tar.gz |
Handle client submitted activitypub like activity
Diffstat (limited to 'test')
-rw-r--r-- | test/web/activity_pub/activity_pub_controller_test.exs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/web/activity_pub/activity_pub_controller_test.exs b/test/web/activity_pub/activity_pub_controller_test.exs index 7aed8c71d..82ad42144 100644 --- a/test/web/activity_pub/activity_pub_controller_test.exs +++ b/test/web/activity_pub/activity_pub_controller_test.exs @@ -292,6 +292,31 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do assert json_response(conn, 400) end + + test "it increases like count when receiving a like action", %{conn: conn} do + note_activity = insert(:note_activity) + user = User.get_cached_by_ap_id(note_activity.data["actor"]) + + data = %{ + type: "Like", + object: %{ + id: note_activity.data["object"]["id"] + } + } + + conn = + conn + |> assign(:user, user) + |> put_req_header("content-type", "application/activity+json") + |> post("/users/#{user.nickname}/outbox", data) + + result = json_response(conn, 201) + assert Activity.get_by_ap_id(result["id"]) + + object = Object.get_by_ap_id(note_activity.data["object"]["id"]) + assert object + assert object.data["like_count"] == 1 + end end describe "/users/:nickname/followers" do |