Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33095702
user_allow_list_policy_test.exs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
user_allow_list_policy_test.exs
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Web.ActivityPub.MRF.UserAllowListPolicyTest
do
use
Pleroma.DataCase
import
Pleroma.Factory
alias
Pleroma.Web.ActivityPub.MRF.UserAllowListPolicy
setup
do
:
clear_config
(
:mrf_user_allowlist
)
test
"pass filter if allow list is empty"
do
actor
=
insert
(
:user
)
message
=
%{
"actor"
=>
actor
.
ap_id
}
assert
UserAllowListPolicy
.
filter
(
message
)
==
{
:ok
,
message
}
end
test
"pass filter if allow list isn't empty and user in allow list"
do
actor
=
insert
(
:user
)
clear_config
([
:mrf_user_allowlist
],
%{
"localhost"
=>
[
actor
.
ap_id
,
"test-ap-id"
]})
message
=
%{
"actor"
=>
actor
.
ap_id
}
assert
UserAllowListPolicy
.
filter
(
message
)
==
{
:ok
,
message
}
end
test
"rejected if allow list isn't empty and user not in allow list"
do
actor
=
insert
(
:user
)
clear_config
([
:mrf_user_allowlist
],
%{
"localhost"
=>
[
"test-ap-id"
]})
message
=
%{
"actor"
=>
actor
.
ap_id
}
assert
{
:reject
,
_
}
=
UserAllowListPolicy
.
filter
(
message
)
end
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 20, 9:28 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
966774
Default Alt Text
user_allow_list_policy_test.exs (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment