diff options
author | lain <lain@soykaf.club> | 2023-06-11 11:02:39 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2023-06-11 11:02:39 +0000 |
commit | 1db29f734f7f12a49ab946ea467b07bf27bdce6d (patch) | |
tree | 589a9e5de87bf652c5557a653c78ca833ef520a9 /test | |
parent | b762a7503cc7179cb452e38fa48199802b539fc7 (diff) | |
parent | a5066bb0789e15d808e99e8676c16ad74290419c (diff) | |
download | pleroma-1db29f734f7f12a49ab946ea467b07bf27bdce6d.tar.gz pleroma-1db29f734f7f12a49ab946ea467b07bf27bdce6d.zip |
Merge branch 'fep-fffd-url' into 'develop'
CommonFields: Use BareUri for :url
Closes #3121
See merge request pleroma/pleroma!3884
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.ex | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.ex b/test/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.ex new file mode 100644 index 000000000..226383c3c --- /dev/null +++ b/test/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.ex @@ -0,0 +1,25 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.BareUriTest do + use Pleroma.DataCase, async: true + + alias Pleroma.EctoType.ActivityPub.ObjectValidators.BareUri + + test "diaspora://" do + text = "diaspora://alice@fediverse.example/post/deadbeefdeadbeefdeadbeefdeadbeef" + assert {:ok, text} = BareUri.cast(text) + end + + test "nostr:" do + text = "nostr:note1gwdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" + assert {:ok, text} = BareUri.cast(text) + end + + test "errors for non-URIs" do + assert :error == SafeText.cast(1) + assert :error == SafeText.cast("foo") + assert :error == SafeText.cast("foo bar") + end +end |