1 defmodule Pleroma.Web.OStatus.OStatusControllerTest do
2 use Pleroma.Web.ConnCase
5 alias Pleroma.Web.OStatus.ActivityRepresenter
7 test "gets a feed", %{conn: conn} do
8 note_activity = insert(:note_activity)
9 user = User.get_cached_by_ap_id(note_activity.data["actor"])
12 |> get("/users/#{user.nickname}/feed.atom")
14 assert response(conn, 200)
17 test "gets an object", %{conn: conn} do
18 note_activity = insert(:note_activity)
19 user = User.get_by_ap_id(note_activity.data["actor"])
20 [_, uuid] = hd Regex.scan(~r/.+\/([\w-]+)$/, note_activity.data["object"]["id"])
21 url = "/objects/#{uuid}"
26 expected = ActivityRepresenter.to_simple_form(note_activity, user, true)
27 |> ActivityRepresenter.wrap_with_entry
28 |> :xmerl.export_simple(:xmerl_xml)
31 assert response(conn, 200) == expected
34 test "gets an activity", %{conn: conn} do
35 note_activity = insert(:note_activity)
36 [_, uuid] = hd Regex.scan(~r/.+\/([\w-]+)$/, note_activity.data["id"])
37 url = "/activities/#{uuid}"
42 assert response(conn, 200)