diff options
author | Alex Gleason <alex@alexgleason.me> | 2020-08-31 16:48:24 -0500 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2020-09-11 14:09:50 -0500 |
commit | f88dc1937e5aa4208143fa68400a5c38a1b9eddf (patch) | |
tree | 25a1de7a4328f9c023bb2e3263b0e742ef7c2455 /test | |
parent | 425324aae3d4534bc045466a1cc15653ddfa27d2 (diff) | |
download | pleroma-f88dc1937e5aa4208143fa68400a5c38a1b9eddf.tar.gz |
MastodonAPI.StatusView.get_user/1 --> CommonAPI.get_user/1
Diffstat (limited to 'test')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 4ba6232dc..d171b344a 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -1126,4 +1126,24 @@ defmodule Pleroma.Web.CommonAPITest do assert Visibility.get_visibility(activity) == "private" end end + + describe "get_user/1" do + test "gets user by ap_id" do + user = insert(:user) + assert CommonAPI.get_user(user.ap_id) == user + end + + test "gets user by guessed nickname" do + user = insert(:user, ap_id: "", nickname: "mario@mushroom.kingdom") + assert CommonAPI.get_user("https://mushroom.kingdom/users/mario") == user + end + + test "fallback" do + assert %User{ + name: "", + ap_id: "", + nickname: "erroruser@example.com" + } = CommonAPI.get_user("") + end + end end |