logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 0f56304f09b5cc43e7c8cf37aab629aed30abfda
parent cfc01a660a7b47578d0b163272ca6cd84d50890a
Author: feld <feld@feld.me>
Date:   Wed,  8 Nov 2023 14:13:37 +0000

Merge branch 'bare_uri_test' into 'develop'

Activate test for object validator that has not been running

See merge request pleroma/pleroma!3968

Diffstat:

Achangelog.d/bare_uri_test.skip0
Dtest/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.ex25-------------------------
Atest/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.exs25+++++++++++++++++++++++++
3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/changelog.d/bare_uri_test.skip b/changelog.d/bare_uri_test.skip 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 @@ -1,25 +0,0 @@ -# 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 diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.exs @@ -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 == BareUri.cast(1) + assert :error == BareUri.cast("foo") + assert :error == BareUri.cast("foo bar") + end +end