config descriptions for custom MRF policies
This commit is contained in:
parent
db07b538a5
commit
485697d96c
16 changed files with 412 additions and 305 deletions
19
test/fixtures/modules/good_mrf.ex
vendored
Normal file
19
test/fixtures/modules/good_mrf.ex
vendored
Normal 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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue