1

I'm attempting to create some unit tests for a method that is closely coupled to the database. I'd like to mock out the sections of the database and was hoping for some help with this.

The method:

on_create_appointment(_, **kwargs):
    occurrences = Appointment.query.join(Occurrence).filter(Occurrence.pk.in_(kwargs['occurrence_id'])
    ect...

my hope is to create a test where i can call this method and mock out an object I define in my test file to be returned by the above query (The query is generated using sqlalchemy)

Khakis7
  • 413
  • 4
  • 19

0 Answers0