title: How to test python database interacting functions
body: <p>I have some function in my python file course.py which is in proj/com/api/course 
  folder. These function interact with database.</p>
  
  <p>I am using flask, sqlalchemy . </p>
  
  <p>course.py </p>
  
  <pre><code>def create(**kwargs):
              user = User()
              session = Session()
              user.name = kwargs['name']
              user.email = kwargs['email']
              session.add(user)
              session.commit()
              session.close()
              return user
  def get_data_by_id(user_id):
          session = Session()
          user = session.query(User).filter(User.id==user_id).first()
          session.close()
          return user
  </code></pre>
  
  <p>My question is where should I create testing module and how set connections with data base to test functions?</p>