diff options
| author | Maksim Pechnikov <parallel588@gmail.com> | 2020-05-08 08:51:09 +0300 |
|---|---|---|
| committer | Maksim Pechnikov <parallel588@gmail.com> | 2020-05-08 08:51:09 +0300 |
| commit | b078e0567dbecc768f88d991a2565141eb9e8c50 (patch) | |
| tree | ed376fc3c17c6e508ac91d8e72cddad128c07c69 /test/web/activity_pub/object_validators | |
| parent | bd261309cc27ebf5d2f78ea3c1474fe71ae8046d (diff) | |
| parent | 769d95644daf07bf27fb483e91d0e793eaa18bd8 (diff) | |
| download | pleroma-b078e0567dbecc768f88d991a2565141eb9e8c50.tar.gz pleroma-b078e0567dbecc768f88d991a2565141eb9e8c50.zip | |
Merge branch 'develop' into issue/1276-2
Diffstat (limited to 'test/web/activity_pub/object_validators')
| -rw-r--r-- | test/web/activity_pub/object_validators/types/recipients_test.exs | 27 |
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 |
