From 1f7e602e2c4a5a217d4297da6f2318016f48946f Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Fri, 1 Jul 2022 19:46:47 +0400 Subject: Handle Improper Output For Unittests The old testing code only checks the first character of the stdout, meaning that if a user succeeds in printing a 1 before the rest of the output, the testing code will consider that a pass and discard the rest. This change checks that the rest of the stdout is empty as expected. Signed-off-by: Hassan Abouelela --- backend/authentication/user.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backend/authentication/user.py') diff --git a/backend/authentication/user.py b/backend/authentication/user.py index 6256cae..cd5a249 100644 --- a/backend/authentication/user.py +++ b/backend/authentication/user.py @@ -37,6 +37,10 @@ class User(BaseUser): def discord_mention(self) -> str: return f"<@{self.payload['id']}>" + @property + def user_id(self) -> str: + return str(self.payload["id"]) + @property def decoded_token(self) -> dict[str, any]: return jwt.decode(self.token, SECRET_KEY, algorithms=["HS256"]) -- cgit v1.2.3