From 8076deeeb4547ff0878978bcbcfc4d2789f636c7 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 7 Nov 2023 16:00:13 -0500 Subject: Activate test for object validator that has not been running --- .../object_validators/bare_uri_test.ex | 25 --------------------- .../object_validators/bare_uri_test.exs | 26 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) delete mode 100644 test/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.ex create mode 100644 test/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.exs (limited to 'test') 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 deleted file mode 100644 index 226383c3c..000000000 --- a/test/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.ex +++ /dev/null @@ -1,25 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2023 Pleroma Authors -# 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 new file mode 100644 index 000000000..8664f7b28 --- /dev/null +++ b/test/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.exs @@ -0,0 +1,26 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2023 Pleroma Authors +# 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 + alias Pleroma.EctoType.ActivityPub.ObjectValidators.SafeText + + 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 -- cgit v1.2.3 From 76c070fe8641f5519ca42dfcecdab3f47d882e8f Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 8 Nov 2023 00:28:26 +0100 Subject: ObjectValidators.BareUriTest: Replace calls of SafeText to BareUri --- .../ecto_type/activity_pub/object_validators/bare_uri_test.exs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test') 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 index 8664f7b28..760ecb465 100644 --- 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 @@ -6,7 +6,6 @@ defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.BareUriTest do use Pleroma.DataCase, async: true alias Pleroma.EctoType.ActivityPub.ObjectValidators.BareUri - alias Pleroma.EctoType.ActivityPub.ObjectValidators.SafeText test "diaspora://" do text = "diaspora://alice@fediverse.example/post/deadbeefdeadbeefdeadbeefdeadbeef" @@ -19,8 +18,8 @@ defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.BareUriTest do end test "errors for non-URIs" do - assert :error == SafeText.cast(1) - assert :error == SafeText.cast("foo") - assert :error == SafeText.cast("foo bar") + assert :error == BareUri.cast(1) + assert :error == BareUri.cast("foo") + assert :error == BareUri.cast("foo bar") end end -- cgit v1.2.3