aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-05-10 18:44:57 +0200
committerRoger Braun <roger@rogerbraun.net>2017-05-10 18:44:57 +0200
commit36448d6483c7f53266052e72bd39b04558478410 (patch)
treeb3a7ddfc2520b33a93a6d3bc1cd1915219e92609 /test
parent2e753e8cd740d540eae7badf5c48197d3914b5f5 (diff)
downloadpleroma-36448d6483c7f53266052e72bd39b04558478410.tar.gz
Add externalprofile to TwAPI.
Diffstat (limited to 'test')
-rw-r--r--test/web/twitter_api/twitter_api_controller_test.exs11
-rw-r--r--test/web/twitter_api/twitter_api_test.exs9
2 files changed, 20 insertions, 0 deletions
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs
index f8afbaee5..0e9d29018 100644
--- a/test/web/twitter_api/twitter_api_controller_test.exs
+++ b/test/web/twitter_api/twitter_api_controller_test.exs
@@ -389,6 +389,17 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
end
end
+ describe "GET /api/externalprofile/show" do
+ test "it returns the user", %{conn: conn} do
+ user = insert(:user)
+
+ conn = conn
+ |> get("/api/externalprofile/show", %{profileurl: user.ap_id})
+
+ assert json_response(conn, 200) == UserRepresenter.to_map(user)
+ end
+ end
+
defp valid_user(_context) do
user = insert(:user)
[user: user]
diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs
index fd309e5ed..ebc9e362f 100644
--- a/test/web/twitter_api/twitter_api_test.exs
+++ b/test/web/twitter_api/twitter_api_test.exs
@@ -358,4 +358,13 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
assert conversation_id == object.id
end
end
+
+ describe "fetching a user by uri" do
+ test "fetches a user by uri" do
+ user = insert(:user)
+
+ {:ok, represented} = TwitterAPI.get_external_profile(user, user.ap_id)
+ assert represented = UserRepresenter.to_map(user, %{for: user})
+ end
+ end
end