mirror of https://gitlab.com/litecord/litecord.git
use uint32 for Permissions' backing integer
prevents negative values from wrapping around to values that are over the limit of postgresql bigint
This commit is contained in:
parent
e0f2a8a8c8
commit
1f8a4fd304
|
|
@ -75,7 +75,7 @@ class Permissions(ctypes.Union):
|
||||||
The permissions value as an integer.
|
The permissions value as an integer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_fields_ = [("bits", _RawPermsBits), ("binary", ctypes.c_uint64)]
|
_fields_ = [("bits", _RawPermsBits), ("binary", ctypes.c_uint32)]
|
||||||
|
|
||||||
def __init__(self, val: Union[str, int]):
|
def __init__(self, val: Union[str, int]):
|
||||||
# always coerce to int, even when the user gives us a str, because
|
# always coerce to int, even when the user gives us a str, because
|
||||||
|
|
|
||||||
|
|
@ -150,3 +150,17 @@ async def test_prune_guild(test_cli_user):
|
||||||
|
|
||||||
pruned_member_guild = await guild.refetch()
|
pruned_member_guild = await guild.refetch()
|
||||||
assert pruned_member_guild.member_count == 1
|
assert pruned_member_guild.member_count == 1
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_guild_roles(test_cli_user):
|
||||||
|
guild = await test_cli_user.create_guild()
|
||||||
|
|
||||||
|
resp = await test_cli_user.post(
|
||||||
|
f"/api/v6/guilds/{guild.id}/roles",
|
||||||
|
json={"name": "myrole", "permissions": -2043163063},
|
||||||
|
)
|
||||||
|
|
||||||
|
assert resp.status_code == 200
|
||||||
|
rjson = await resp.json
|
||||||
|
assert rjson["name"] == "myrole"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue