projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update mogrify package
[akkoma]
/
test
/
web
/
activity_pub
/
mrf
/
vocabulary_policy_test.exs
diff --git
a/test/web/activity_pub/mrf/vocabulary_policy_test.exs
b/test/web/activity_pub/mrf/vocabulary_policy_test.exs
index c3b11d7a14543dd4b03fdcbbd43790a25a101e7d..2bceb67ee85f6768430c4a53389748b2899a4a32 100644
(file)
--- a/
test/web/activity_pub/mrf/vocabulary_policy_test.exs
+++ b/
test/web/activity_pub/mrf/vocabulary_policy_test.exs
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
@@
-8,8
+8,9
@@
defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
alias Pleroma.Web.ActivityPub.MRF.VocabularyPolicy
describe "accept" do
alias Pleroma.Web.ActivityPub.MRF.VocabularyPolicy
describe "accept" do
+ setup do: clear_config([:mrf_vocabulary, :accept])
+
test "it accepts based on parent activity type" do
test "it accepts based on parent activity type" do
- config = Pleroma.Config.get([:mrf_vocabulary, :accept])
Pleroma.Config.put([:mrf_vocabulary, :accept], ["Like"])
message = %{
Pleroma.Config.put([:mrf_vocabulary, :accept], ["Like"])
message = %{
@@
-18,12
+19,9
@@
defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
}
{:ok, ^message} = VocabularyPolicy.filter(message)
}
{:ok, ^message} = VocabularyPolicy.filter(message)
-
- Pleroma.Config.put([:mrf_vocabulary, :accept], config)
end
test "it accepts based on child object type" do
end
test "it accepts based on child object type" do
- config = Pleroma.Config.get([:mrf_vocabulary, :accept])
Pleroma.Config.put([:mrf_vocabulary, :accept], ["Create", "Note"])
message = %{
Pleroma.Config.put([:mrf_vocabulary, :accept], ["Create", "Note"])
message = %{
@@
-35,12
+33,9
@@
defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
}
{:ok, ^message} = VocabularyPolicy.filter(message)
}
{:ok, ^message} = VocabularyPolicy.filter(message)
-
- Pleroma.Config.put([:mrf_vocabulary, :accept], config)
end
test "it does not accept disallowed child objects" do
end
test "it does not accept disallowed child objects" do
- config = Pleroma.Config.get([:mrf_vocabulary, :accept])
Pleroma.Config.put([:mrf_vocabulary, :accept], ["Create", "Note"])
message = %{
Pleroma.Config.put([:mrf_vocabulary, :accept], ["Create", "Note"])
message = %{
@@
-51,13
+46,10
@@
defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
}
}
}
}
- {:reject, nil} = VocabularyPolicy.filter(message)
-
- Pleroma.Config.put([:mrf_vocabulary, :accept], config)
+ {:reject, _} = VocabularyPolicy.filter(message)
end
test "it does not accept disallowed parent types" do
end
test "it does not accept disallowed parent types" do
- config = Pleroma.Config.get([:mrf_vocabulary, :accept])
Pleroma.Config.put([:mrf_vocabulary, :accept], ["Announce", "Note"])
message = %{
Pleroma.Config.put([:mrf_vocabulary, :accept], ["Announce", "Note"])
message = %{
@@
-68,15
+60,14
@@
defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
}
}
}
}
- {:reject, nil} = VocabularyPolicy.filter(message)
-
- Pleroma.Config.put([:mrf_vocabulary, :accept], config)
+ {:reject, _} = VocabularyPolicy.filter(message)
end
end
describe "reject" do
end
end
describe "reject" do
+ setup do: clear_config([:mrf_vocabulary, :reject])
+
test "it rejects based on parent activity type" do
test "it rejects based on parent activity type" do
- config = Pleroma.Config.get([:mrf_vocabulary, :reject])
Pleroma.Config.put([:mrf_vocabulary, :reject], ["Like"])
message = %{
Pleroma.Config.put([:mrf_vocabulary, :reject], ["Like"])
message = %{
@@
-84,13
+75,10
@@
defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
"object" => "whatever"
}
"object" => "whatever"
}
- {:reject, nil} = VocabularyPolicy.filter(message)
-
- Pleroma.Config.put([:mrf_vocabulary, :reject], config)
+ {:reject, _} = VocabularyPolicy.filter(message)
end
test "it rejects based on child object type" do
end
test "it rejects based on child object type" do
- config = Pleroma.Config.get([:mrf_vocabulary, :reject])
Pleroma.Config.put([:mrf_vocabulary, :reject], ["Note"])
message = %{
Pleroma.Config.put([:mrf_vocabulary, :reject], ["Note"])
message = %{
@@
-101,13
+89,10
@@
defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
}
}
}
}
- {:reject, nil} = VocabularyPolicy.filter(message)
-
- Pleroma.Config.put([:mrf_vocabulary, :reject], config)
+ {:reject, _} = VocabularyPolicy.filter(message)
end
test "it passes through objects that aren't disallowed" do
end
test "it passes through objects that aren't disallowed" do
- config = Pleroma.Config.get([:mrf_vocabulary, :reject])
Pleroma.Config.put([:mrf_vocabulary, :reject], ["Like"])
message = %{
Pleroma.Config.put([:mrf_vocabulary, :reject], ["Like"])
message = %{
@@
-116,8
+101,6
@@
defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
}
{:ok, ^message} = VocabularyPolicy.filter(message)
}
{:ok, ^message} = VocabularyPolicy.filter(message)
-
- Pleroma.Config.put([:mrf_vocabulary, :reject], config)
end
end
end
end
end
end