diff options
author | sxsdv1 <sxsdv1@gmail.com> | 2019-01-08 23:22:15 +0100 |
---|---|---|
committer | sxsdv1 <sxsdv1@gmail.com> | 2019-01-09 09:33:30 +0100 |
commit | 20c0dd1e24b128e0be51197ac2d150052817c219 (patch) | |
tree | ebbcb293ae59766e36a57bdb81416e68a8ea3c2d /test | |
parent | 5c5c8508c203886f32b150e7d8c1f7362a4fde0e (diff) | |
download | pleroma-20c0dd1e24b128e0be51197ac2d150052817c219.tar.gz |
Support activity+json request for activity
Diffstat (limited to 'test')
-rw-r--r-- | test/web/activity_pub/activity_pub_controller_test.exs | 26 |
1 files changed, 26 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 7d1fe184e..7aed8c71d 100644 --- a/test/web/activity_pub/activity_pub_controller_test.exs +++ b/test/web/activity_pub/activity_pub_controller_test.exs @@ -89,6 +89,32 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do end end + describe "/activities/:uuid" do + test "it returns a json representation of the activity", %{conn: conn} do + activity = insert(:note_activity) + uuid = String.split(activity.data["id"], "/") |> List.last() + + conn = + conn + |> put_req_header("accept", "application/activity+json") + |> get("/activities/#{uuid}") + + assert json_response(conn, 200) == ObjectView.render("object.json", %{object: activity}) + end + + test "it returns 404 for non-public activities", %{conn: conn} do + activity = insert(:direct_note_activity) + uuid = String.split(activity.data["id"], "/") |> List.last() + + conn = + conn + |> put_req_header("accept", "application/activity+json") + |> get("/activities/#{uuid}") + + assert json_response(conn, 404) + end + end + describe "/inbox" do test "it inserts an incoming activity into the database", %{conn: conn} do data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!() |