diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2020-09-18 07:08:37 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2020-09-18 07:08:37 +0300 |
commit | 2ec0dcf00194544449a5d7768ab10777b294895b (patch) | |
tree | 1c2f097403f48e6f43894ac792ce77dc5992b32d /test/web/common_api/common_api_test.exs | |
parent | 5a8ea0a5b07c22d567a60af36345483fe880b638 (diff) | |
parent | 49584a9928f02b461a0356332440084473ea6b69 (diff) | |
download | pleroma-2ec0dcf00194544449a5d7768ab10777b294895b.tar.gz pleroma-2ec0dcf00194544449a5d7768ab10777b294895b.zip |
Merge branch 'develop' into issue/2099
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 31 |
1 files changed, 31 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..2eab64e8b 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -217,6 +217,17 @@ defmodule Pleroma.Web.CommonAPITest do assert message == :content_too_long end + + test "it reject messages via MRF" do + clear_config([:mrf_keyword, :reject], ["GNO"]) + clear_config([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.KeywordPolicy]) + + author = insert(:user) + recipient = insert(:user) + + assert {:reject, "[KeywordPolicy] Matches with rejected keyword"} == + CommonAPI.post_chat_message(author, recipient, "GNO/Linux") + end end describe "unblocking" do @@ -1193,4 +1204,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 |