@@ -46,3 +46,34 @@ def test_seo_report_is_public_read_only_http_action():
|
||||
assert "seo_report" not in CONFIRM_REQUIRED
|
||||
names = {p.name for p in action.params}
|
||||
assert "uid" in names
|
||||
|
||||
|
||||
def test_block_mute_tools_exist_as_http_actions():
|
||||
expected = {
|
||||
"block_user": "/block/{username}",
|
||||
"unblock_user": "/block/unblock/{username}",
|
||||
"mute_user": "/mute/{username}",
|
||||
"unmute_user": "/mute/unmute/{username}",
|
||||
}
|
||||
for name, path in expected.items():
|
||||
action = BY_NAME[name]
|
||||
assert action.handler == "http"
|
||||
assert action.method == "POST"
|
||||
assert action.path == path
|
||||
assert action.requires_auth is True
|
||||
assert action.requires_admin is False
|
||||
assert "username" in {p.name for p in action.params}
|
||||
|
||||
|
||||
def test_block_mute_tools_visible_to_authenticated_user():
|
||||
schemas = PLATFORM_CATALOG.tool_schemas_for(authenticated=True, is_admin=False)
|
||||
names = {s["function"]["name"] for s in schemas}
|
||||
for name in ("block_user", "unblock_user", "mute_user", "unmute_user"):
|
||||
assert name in names
|
||||
|
||||
|
||||
def test_block_mute_tools_hidden_from_guests():
|
||||
schemas = PLATFORM_CATALOG.tool_schemas_for(authenticated=False)
|
||||
names = {s["function"]["name"] for s in schemas}
|
||||
for name in ("block_user", "unblock_user", "mute_user", "unmute_user"):
|
||||
assert name not in names
|
||||
|
||||
Reference in New Issue
Block a user