1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-12-05 02:31:33 +00:00

Add docstrings to webservice UserOps class

This commit is contained in:
Kristóf Tóth 2018-04-28 19:24:15 +02:00
parent 0e83c31587
commit 9ec0132e06

View File

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