Remove the debugging IO.inspect
[akkoma] / test / web / twitter_api / representers / object_representer_test.exs
1 defmodule Pleroma.Web.TwitterAPI.Representers.ObjectReprenterTest do
2 use Pleroma.DataCase
3
4 alias Pleroma.Object
5 alias Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter
6
7 test "represent an image attachment" do
8 object = %Object{
9 id: 5,
10 data: %{
11 "type" => "Image",
12 "url" => [
13 %{
14 "mediaType" => "sometype",
15 "href" => "someurl"
16 }
17 ],
18 "uuid" => 6
19 }
20 }
21
22 expected_object = %{
23 id: 6,
24 url: "someurl",
25 mimetype: "sometype",
26 oembed: false,
27 description: nil
28 }
29
30 assert expected_object == ObjectRepresenter.to_map(object)
31 end
32
33 test "represents mastodon-style attachments" do
34 object = %Object{
35 id: nil,
36 data: %{
37 "mediaType" => "image/png",
38 "name" => "blabla",
39 "type" => "Document",
40 "url" =>
41 "http://mastodon.example.org/system/media_attachments/files/000/000/001/original/8619f31c6edec470.png"
42 }
43 }
44
45 expected_object = %{
46 url:
47 "http://mastodon.example.org/system/media_attachments/files/000/000/001/original/8619f31c6edec470.png",
48 mimetype: "image/png",
49 oembed: false,
50 id: nil,
51 description: "blabla"
52 }
53
54 assert expected_object == ObjectRepresenter.to_map(object)
55 end
56 end