diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-09-17 17:14:20 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-09-17 17:14:20 +0300 |
commit | d9fb5bc08ad67b55d0cd25c1a0d7d3a740758427 (patch) | |
tree | 6303695147d01ab5e71e556f2b8f7725536e475f /test/web/common_api/common_api_test.exs | |
parent | 7cdbd91d83c02a79c22783ca489ef82e82b31a51 (diff) | |
parent | cd93aa2aed6fda516d4fc2aabb44c5e178a6543d (diff) | |
download | pleroma-d9fb5bc08ad67b55d0cd25c1a0d7d3a740758427.tar.gz pleroma-d9fb5bc08ad67b55d0cd25c1a0d7d3a740758427.zip |
Merge remote-tracking branch 'remotes/origin/develop' into media-preview-proxy-nostream
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-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 5afb0a6dc..f5559f932 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -1193,4 +1193,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 |