X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fostatus%2Fuser_representer_test.exs;h=e3863d2e9ca1d087bd39be70111d173c2617a4a5;hb=8a41d34673532c03cf99a2334399b9436e245f1b;hp=02a4b5b141e6beb3e51559835c72efed7533dfc0;hpb=36e883cd4bed9c07df2a1dc1038265e075bea5c6;p=akkoma
diff --git a/test/web/ostatus/user_representer_test.exs b/test/web/ostatus/user_representer_test.exs
index 02a4b5b14..e3863d2e9 100644
--- a/test/web/ostatus/user_representer_test.exs
+++ b/test/web/ostatus/user_representer_test.exs
@@ -1,17 +1,38 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2018 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.OStatus.UserRepresenterTest do
use Pleroma.DataCase
alias Pleroma.Web.OStatus.UserRepresenter
import Pleroma.Factory
+ alias Pleroma.User
test "returns a user with id, uri, name and link" do
- user = build(:user)
- tuple = UserRepresenter.to_tuple(user)
- {:author, author} = tuple
+ user = insert(:user, %{nickname: "ã¬ã¤ã³"})
+ tuple = UserRepresenter.to_simple_form(user)
+
+ res = :xmerl.export_simple_content(tuple, :xmerl_xml) |> to_string
+
+ expected = """
+ #{user.ap_id}
+ http://activitystrea.ms/schema/1.0/person
+ #{user.ap_id}
+ #{user.nickname}
+ #{user.name}
+ #{user.bio}
+ #{user.bio}
+ #{user.nickname}
+
+
+ true
+ """
+
+ assert clean(res) == clean(expected)
+ end
- [:id, :uri, :name, :link]
- |> Enum.each(fn (tag) ->
- assert Enum.find(author, fn(e) -> tag == elem(e, 0) end)
- end)
+ defp clean(string) do
+ String.replace(string, ~r/\s/, "")
end
end