diff options
author | Roman Chvanikov <chvanikoff@pm.me> | 2020-09-20 19:27:27 +0300 |
---|---|---|
committer | Roman Chvanikov <chvanikoff@pm.me> | 2020-09-20 19:27:27 +0300 |
commit | 4987ee6256c4227793240c74043845a661e3d37b (patch) | |
tree | 40abf0e0c85df9788b59f24ed4026ae00a89e5e5 /test/web/common_api/common_api_test.exs | |
parent | 44e8b6037ae71881327451dcf7d9351f1ba82674 (diff) | |
parent | 882c1fc6bdff4e27955730a412d73ead0e67a741 (diff) | |
download | pleroma-4987ee6256c4227793240c74043845a661e3d37b.tar.gz pleroma-4987ee6256c4227793240c74043845a661e3d37b.zip |
Merge branch 'develop' into feature/expire-mutes
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 bdc569e64..bf4353a57 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 @@ -1209,4 +1220,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 |