2017-03-30 10:08:49 -04:00
|
|
|
defmodule Pleroma.Web.TwitterAPI.Representers.ObjectReprenterTest do
|
|
|
|
use Pleroma.DataCase
|
|
|
|
|
|
|
|
alias Pleroma.Object
|
|
|
|
alias Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter
|
|
|
|
|
|
|
|
test "represent an image attachment" do
|
|
|
|
object = %Object{
|
|
|
|
id: 5,
|
|
|
|
data: %{
|
|
|
|
"type" => "Image",
|
|
|
|
"url" => [
|
|
|
|
%{
|
|
|
|
"mediaType" => "sometype",
|
|
|
|
"href" => "someurl"
|
|
|
|
}
|
2017-03-30 11:07:03 -04:00
|
|
|
],
|
|
|
|
"uuid" => 6
|
2017-03-30 10:08:49 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
expected_object = %{
|
2017-03-30 11:07:03 -04:00
|
|
|
id: 6,
|
2017-03-30 10:08:49 -04:00
|
|
|
url: "someurl",
|
|
|
|
mimetype: "sometype",
|
|
|
|
oembed: false
|
|
|
|
}
|
|
|
|
|
|
|
|
assert expected_object == ObjectRepresenter.to_map(object)
|
|
|
|
end
|
|
|
|
end
|