Add `account_activation_required` to /api/v1/instance
[akkoma] / test / web / activity_pub / object_validators / types / object_id_test.exs
1 defmodule Pleroma.Web.ObjectValidators.Types.ObjectIDTest do
2 alias Pleroma.Web.ActivityPub.ObjectValidators.Types.ObjectID
3 use Pleroma.DataCase
4
5 @uris [
6 "http://lain.com/users/lain",
7 "http://lain.com",
8 "https://lain.com/object/1"
9 ]
10
11 @non_uris [
12 "https://",
13 "rin",
14 1,
15 :x,
16 %{"1" => 2}
17 ]
18
19 test "it accepts http uris" do
20 Enum.each(@uris, fn uri ->
21 assert {:ok, uri} == ObjectID.cast(uri)
22 end)
23 end
24
25 test "it accepts an object with a nested uri id" do
26 Enum.each(@uris, fn uri ->
27 assert {:ok, uri} == ObjectID.cast(%{"id" => uri})
28 end)
29 end
30
31 test "it rejects non-uri strings" do
32 Enum.each(@non_uris, fn non_uri ->
33 assert :error == ObjectID.cast(non_uri)
34 assert :error == ObjectID.cast(%{"id" => non_uri})
35 end)
36 end
37 end