See #853: advertise allow-list configuration in nodeinfo
This commit is contained in:
parent
38a8e998fd
commit
581e890ad9
2 changed files with 34 additions and 1 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import pytest
|
||||
|
||||
import funkwhale_api
|
||||
from funkwhale_api.instance import nodeinfo
|
||||
from funkwhale_api.federation import actors
|
||||
|
|
@ -48,6 +50,7 @@ def test_nodeinfo_dump(preferences, mocker):
|
|||
"listenings": {"total": stats["listenings"]},
|
||||
},
|
||||
"supportedUploadExtensions": music_utils.SUPPORTED_EXTENSIONS,
|
||||
"allowList": {"enabled": False, "domains": None},
|
||||
},
|
||||
}
|
||||
assert nodeinfo.get() == expected
|
||||
|
|
@ -79,6 +82,25 @@ def test_nodeinfo_dump_stats_disabled(preferences, mocker):
|
|||
],
|
||||
},
|
||||
"supportedUploadExtensions": music_utils.SUPPORTED_EXTENSIONS,
|
||||
"allowList": {"enabled": False, "domains": None},
|
||||
},
|
||||
}
|
||||
assert nodeinfo.get() == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"enabled, public, expected",
|
||||
[
|
||||
(True, True, {"enabled": True, "domains": ["allowed.example"]}),
|
||||
(True, False, {"enabled": True, "domains": None}),
|
||||
(False, False, {"enabled": False, "domains": None}),
|
||||
],
|
||||
)
|
||||
def test_nodeinfo_allow_list_enabled(preferences, factories, enabled, public, expected):
|
||||
preferences["moderation__allow_list_enabled"] = enabled
|
||||
preferences["moderation__allow_list_public"] = public
|
||||
factories["federation.Domain"](name="allowed.example", allowed=True)
|
||||
factories["federation.Domain"](allowed=False)
|
||||
factories["federation.Domain"](allowed=None)
|
||||
|
||||
assert nodeinfo.get()["metadata"]["allowList"] == expected
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue