summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2024-02-15 01:30:22 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2024-02-15 01:30:22 +0000
commitd19642d7eba9adc51de48b113f5a5ebfafbaf40d (patch)
treeda3cd96b005d783bf6ed61614e0dcdac8213f5d3 /test
parent802c618885c69046fa89203a627a7f7f95979be3 (diff)
parent799891d359363ab66fc0e351ad8140b689027fc4 (diff)
Merge branch 'bugfix-ccworks' into 'develop'
Bugfix for ccworks AP bridge Closes #3234 See merge request pleroma/pleroma!4043
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/ccworld-ap-bridge_note.json1
-rw-r--r--test/pleroma/maps_test.exs22
-rw-r--r--test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs11
3 files changed, 34 insertions, 0 deletions
diff --git a/test/fixtures/ccworld-ap-bridge_note.json b/test/fixtures/ccworld-ap-bridge_note.json
new file mode 100644
index 000000000..4b13b4bc1
--- /dev/null
+++ b/test/fixtures/ccworld-ap-bridge_note.json
@@ -0,0 +1 @@
+{"@context":"https://www.w3.org/ns/activitystreams","type":"Note","id":"https://cc.mkdir.uk/ap/note/e5d1d0a1-1ab3-4498-9949-588e3fdea286","attributedTo":"https://cc.mkdir.uk/ap/acct/hiira","inReplyTo":"","quoteUrl":"","content":"おはコンー","published":"2024-01-19T22:08:05Z","to":["https://www.w3.org/ns/activitystreams#Public"],"tag":null,"attachment":[],"object":null}
diff --git a/test/pleroma/maps_test.exs b/test/pleroma/maps_test.exs
new file mode 100644
index 000000000..05f1b18b2
--- /dev/null
+++ b/test/pleroma/maps_test.exs
@@ -0,0 +1,22 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2024 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.MapsTest do
+ use Pleroma.DataCase, async: true
+
+ alias Pleroma.Maps
+
+ describe "filter_empty_values/1" do
+ assert %{"bar" => "b", "ray" => ["foo"], "objs" => %{"a" => "b"}} ==
+ Maps.filter_empty_values(%{
+ "foo" => nil,
+ "fooz" => "",
+ "bar" => "b",
+ "rei" => [],
+ "ray" => ["foo"],
+ "obj" => %{},
+ "objs" => %{"a" => "b"}
+ })
+ end
+end
diff --git a/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs
index 4703c3801..2b33950d6 100644
--- a/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs
@@ -93,6 +93,17 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
%{valid?: true} = ArticleNotePageValidator.cast_and_validate(note)
end
+ test "a Note from Convergence AP Bridge validates" do
+ insert(:user, ap_id: "https://cc.mkdir.uk/ap/acct/hiira")
+
+ note =
+ "test/fixtures/ccworld-ap-bridge_note.json"
+ |> File.read!()
+ |> Jason.decode!()
+
+ %{valid?: true} = ArticleNotePageValidator.cast_and_validate(note)
+ end
+
test "a note with an attachment should work", _ do
insert(:user, %{ap_id: "https://owncast.localhost.localdomain/federation/user/streamer"})