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():