summaryrefslogtreecommitdiff
path: root/test/web/ostatus/ostatus_controller_test.exs
blob: 8b7ca4d8933dcbbe5191ebf6d98672a79a7637a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
defmodule Pleroma.Web.OStatus.OStatusControllerTest do
  use Pleroma.Web.ConnCase
  import Pleroma.Factory
  alias Pleroma.User

  test "gets a feed", %{conn: conn} do
    note_activity = insert(:note_activity)
    user = User.get_cached_by_ap_id(note_activity.data["actor"])

    conn = conn
    |> get("/users/#{user.nickname}/feed.atom")

    assert response(conn, 200)
  end

  test "gets an object", %{conn: conn} do
    note_activity = insert(:note_activity)
    [_, uuid] = hd Regex.scan(~r/.+\/([\w-]+)$/, note_activity.data["object"]["id"])
    url = "/objects/#{uuid}"

    conn = conn
    |> get(url)

    assert response(conn, 200)
  end
end