config descriptions for custom MRF policies

This commit is contained in:
Alexander Strizhakov 2020-11-10 19:18:53 +03:00
commit 485697d96c
No known key found for this signature in database
GPG key ID: 022896A53AEF1381
16 changed files with 412 additions and 305 deletions

19
test/fixtures/modules/good_mrf.ex vendored Normal file
View file

@ -0,0 +1,19 @@
defmodule Fixtures.Modules.GoodMRF do
@behaviour Pleroma.Web.ActivityPub.MRF
@impl true
def filter(a), do: {:ok, a}
@impl true
def describe, do: %{}
@impl true
def config_description do
%{
key: :good_mrf,
related_policy: "Fixtures.Modules.GoodMRF",
label: "Good MRF",
description: "Some description"
}
end
end

View file

@ -87,4 +87,21 @@ defmodule Pleroma.Web.ActivityPub.MRFTest do
{:ok, ^expected} = MRF.describe()
end
end
test "config_descriptions/0" do
descriptions = MRF.config_descriptions()
good_mrf = Enum.find(descriptions, fn %{key: key} -> key == :good_mrf end)
assert good_mrf == %{
key: :good_mrf,
related_policy: "Fixtures.Modules.GoodMRF",
label: "Good MRF",
description: "Some description",
children: [],
group: :pleroma,
tab: :mrf,
type: :group
}
end
end