mirror of
				https://github.com/avatao-content/test-tutorial-framework
				synced 2025-11-04 11:12:55 +00:00 
			
		
		
		
	Add docstrings to webservice UserOps class
This commit is contained in:
		@@ -9,6 +9,13 @@ class UserOps:
 | 
				
			|||||||
        self.password = password
 | 
					        self.password = password
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def authenticate(self):
 | 
					    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:
 | 
					        with Session() as db:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            user = db.query(User).filter(User.username == self.username).first()
 | 
					            user = db.query(User).filter(User.username == self.username).first()
 | 
				
			||||||
@@ -17,6 +24,13 @@ class UserOps:
 | 
				
			|||||||
                raise InvalidCredentialsError
 | 
					                raise InvalidCredentialsError
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def register(self):
 | 
					    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:
 | 
					        with Session() as db:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if db.query(User).filter(User.username == self.username).all():
 | 
					            if db.query(User).filter(User.username == self.username).all():
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user