Add recognized activity types to a constant and use it in the test
This commit is contained in:
parent
5205e846eb
commit
e38f5f1a81
2 changed files with 21 additions and 1 deletions
|
@ -85,6 +85,24 @@ defmodule Pleroma.Constants do
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const(activity_types,
|
||||||
|
do: [
|
||||||
|
"Create",
|
||||||
|
"Update",
|
||||||
|
"Delete",
|
||||||
|
"Follow",
|
||||||
|
"Accept",
|
||||||
|
"Reject",
|
||||||
|
"Add",
|
||||||
|
"Remove",
|
||||||
|
"Like",
|
||||||
|
"Announce",
|
||||||
|
"Undo",
|
||||||
|
"Flag",
|
||||||
|
"EmojiReact"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
const(allowed_activity_types_from_strangers,
|
const(allowed_activity_types_from_strangers,
|
||||||
do: [
|
do: [
|
||||||
"Block",
|
"Block",
|
||||||
|
|
|
@ -689,7 +689,9 @@ test "without valid signature, " <>
|
||||||
# Once we begin processing it through Oban we risk fetching the actor to validate the
|
# Once we begin processing it through Oban we risk fetching the actor to validate the
|
||||||
# activity which just leads to inserting a new user to process a Delete not relevant to us.
|
# activity which just leads to inserting a new user to process a Delete not relevant to us.
|
||||||
test "Activities of certain types from an unknown actor are discarded", %{conn: conn} do
|
test "Activities of certain types from an unknown actor are discarded", %{conn: conn} do
|
||||||
example_bad_types = ["Announce", "Delete", "Undo"]
|
example_bad_types =
|
||||||
|
Pleroma.Constants.activity_types() --
|
||||||
|
Pleroma.Constants.allowed_activity_types_from_strangers()
|
||||||
|
|
||||||
Enum.each(example_bad_types, fn bad_type ->
|
Enum.each(example_bad_types, fn bad_type ->
|
||||||
params =
|
params =
|
||||||
|
|
Loading…
Reference in a new issue