Discord perms: partial guild payload is unknown, not a deny (#225 S1 review)
A guild without its @everyone role (or that role's permissions) was read as base 0, a definite deny that would block a start. It now raises ValueError, which S3 treats as unknown and lets the start go ahead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
09746c467b
commit
9e850fedf0
@@ -245,9 +245,21 @@ def test_unknown_member_role_ids_are_ignored():
|
||||
assert bits == VOICE
|
||||
|
||||
|
||||
def test_missing_everyone_role_means_empty_base():
|
||||
g = {"id": GUILD, "owner_id": OWNER, "roles": []}
|
||||
bits, trace = eff(g, member(), channel())
|
||||
@pytest.mark.parametrize("g", [
|
||||
{"id": GUILD, "owner_id": OWNER, "roles": []},
|
||||
{"id": GUILD, "owner_id": OWNER},
|
||||
{"id": GUILD, "owner_id": OWNER, "roles": [{"id": GUILD, "name": "@everyone"}]},
|
||||
{"owner_id": OWNER, "roles": [{"id": GUILD, "name": "@everyone", "permissions": "0"}]},
|
||||
])
|
||||
def test_partial_guild_payload_raises_not_silently_denies(g):
|
||||
# A guild without its @everyone role (or its permissions) is a partial
|
||||
# payload: "unknown" (ValueError, start goes ahead), never a definite deny.
|
||||
with pytest.raises(ValueError):
|
||||
eff(g, member(), channel())
|
||||
|
||||
|
||||
def test_everyone_role_granting_nothing_is_a_real_deny():
|
||||
bits, trace = eff(guild(everyone=0), member(), channel())
|
||||
assert bits == 0 and "not granted" in trace["View Channel"]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user