1 defmodule Pleroma.Web.OStatus.FeedRepresenterTest do
5 alias Pleroma.Web.OStatus.{FeedRepresenter, UserRepresenter}
6 alias Pleroma.Web.OStatus
8 test "returns a feed of the last 20 items of the user" do
9 note_activity = insert(:note_activity)
10 user = User.get_cached_by_ap_id(note_activity.data["actor"])
12 tuple = FeedRepresenter.to_simple_form(user, [note_activity], [user])
14 most_recent_update = note_activity.updated_at
15 |> NaiveDateTime.to_iso8601
17 res = :xmerl.export_simple_content(tuple, :xmerl_xml) |> IO.iodata_to_binary
18 user_xml = UserRepresenter.to_simple_form(user)
19 |> :xmerl.export_simple_content(:xmerl_xml)
22 <feed xmlns="http://www.w3.org/2005/Atom" xmlns:activity="http://activitystrea.ms/spec/1.0/">
23 <id>#{OStatus.feed_path(user)}</id>
24 <title>#{user.nickname}'s timeline</title>
25 <updated>#{most_recent_update}</updated>
27 <link rel="hub" href="#{OStatus.pubsub_path}" />
33 assert clean(res) == clean(expected)
37 String.replace(string, ~r/\s/, "")