From 9ec0132e064a3f93a4635bc6c102b50e705d7454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Sat, 28 Apr 2018 19:24:15 +0200 Subject: [PATCH] Add docstrings to webservice UserOps class --- solvable/src/webservice/user_ops.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/solvable/src/webservice/user_ops.py b/solvable/src/webservice/user_ops.py index e90a8bd..ba6bbd3 100644 --- a/solvable/src/webservice/user_ops.py +++ b/solvable/src/webservice/user_ops.py @@ -9,6 +9,13 @@ class UserOps: self.password = password def authenticate(self): + """ + Attempts to authenticate the user. + Raises an exception on failure, does nothing on success. + + :raises InvalidCredentialsError: + User does not exist or password provided is invalid + """ with Session() as db: user = db.query(User).filter(User.username == self.username).first() @@ -17,6 +24,13 @@ class UserOps: raise InvalidCredentialsError def register(self): + """ + Attempts to register a user. + Raises an exception of failure, does nothing on success. + + :raises UserExistsError: + A user with the provided username already exists + """ with Session() as db: if db.query(User).filter(User.username == self.username).all():