summaryrefslogtreecommitdiff
path: root/test/web/activity_pub/object_validators
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-05-07 15:03:12 +0200
committerlain <lain@soykaf.club>2020-05-07 15:03:12 +0200
commit7ac0cffb34567dd72877e13968a10d206f643ad8 (patch)
tree061fbd748a1b62ddd0555dcb257c39ff5f2ce48a /test/web/activity_pub/object_validators
parentdb55dc944581b1d4b50d1608b2e991050ea29bb3 (diff)
parentb7635bf2b6c5251ffc8f3b3b8e1bc7ee9db83b7e (diff)
downloadpleroma-7ac0cffb34567dd72877e13968a10d206f643ad8.tar.gz
pleroma-7ac0cffb34567dd72877e13968a10d206f643ad8.zip
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/emojireactvalidator
Diffstat (limited to 'test/web/activity_pub/object_validators')
-rw-r--r--test/web/activity_pub/object_validators/types/recipients_test.exs27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/web/activity_pub/object_validators/types/recipients_test.exs b/test/web/activity_pub/object_validators/types/recipients_test.exs
new file mode 100644
index 000000000..f278f039b
--- /dev/null
+++ b/test/web/activity_pub/object_validators/types/recipients_test.exs
@@ -0,0 +1,27 @@
+defmodule Pleroma.Web.ObjectValidators.Types.RecipientsTest do
+ alias Pleroma.Web.ActivityPub.ObjectValidators.Types.Recipients
+ use Pleroma.DataCase
+
+ test "it asserts that all elements of the list are object ids" do
+ list = ["https://lain.com/users/lain", "invalid"]
+
+ assert :error == Recipients.cast(list)
+ end
+
+ test "it works with a list" do
+ list = ["https://lain.com/users/lain"]
+ assert {:ok, list} == Recipients.cast(list)
+ end
+
+ test "it works with a list with whole objects" do
+ list = ["https://lain.com/users/lain", %{"id" => "https://gensokyo.2hu/users/raymoo"}]
+ resulting_list = ["https://gensokyo.2hu/users/raymoo", "https://lain.com/users/lain"]
+ assert {:ok, resulting_list} == Recipients.cast(list)
+ end
+
+ test "it turns a single string into a list" do
+ recipient = "https://lain.com/users/lain"
+
+ assert {:ok, [recipient]} == Recipients.cast(recipient)
+ end
+end