Getting orders by period

Now, we are going to test the get_order_by_period method, which returns a list of orders given an initial and an end date. For this method, we are going to perform the following tests:

  • Call the method, passing as arguments, and orders created within that period should be returned
  • Call the method, passing as arguments valid dates where we know that no orders were created, which should return an empty result
  • Test if an exception is raised when calling the method, passing an invalid start date
  • Test if an exception is raised when calling the method, passing an invalid end date
def test_get_orders_by_period(self):    date_from = timezone.now() - relativedelta(days=1)    date_to = date_from + relativedelta(days=2) orders = ...

Get Python Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.