From b31a934a804aed3f35442ceafe2080b0955e7317 Mon Sep 17 00:00:00 2001 From: dcc Date: Wed, 15 May 2024 00:57:23 -0700 Subject: total rebase --- .../object_validators/bare_uri_test.exs | 25 ++++++++++++++++++++++ .../object_validators/date_time_test.exs | 0 .../object_validators/object_id_test.exs | 0 .../object_validators/recipients_test.exs | 0 .../object_validators/safe_text_test.exs | 0 5 files changed, 25 insertions(+) create mode 100644 test/pleroma/ecto_type/activity_pub/object_validators/bare_uri_test.exs mode change 100755 => 100644 test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs mode change 100755 => 100644 test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs mode change 100755 => 100644 test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs mode change 100755 => 100644 test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs (limited to 'test/pleroma/ecto_type') 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 0000000..760ecb4 --- /dev/null +++ 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 +# 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 diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs old mode 100755 new mode 100644 diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs old mode 100755 new mode 100644 diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs old mode 100755 new mode 100644 diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs old mode 100755 new mode 100644 -- cgit v1.2.3