February 2018
Intermediate to advanced
456 pages
9h 56m
English
Next, we are going to test get_customer_completed_order. This method, as the name says, returns all the orders that have a status of Completed for a given customer. Here, we will test the same scenarios as get_customer_incompleted_orders:
def test_get_customer_completed_orders(self): orders = Order.objects.get_customer_completed_orders(customer_id=1) self.assertEqual(1, len(orders)) self.assertEqual(Status.Completed.value, orders[0].status)def test_get_customer_completed_orders_with_invalid_id(self): with self.assertRaises(InvalidArgumentError): Order.objects.get_customer_completed_orders('o')
First, we call get_customer_completed_orders, passing a customer ID equal to 1, and then we verify that the number ...
Read now
Unlock full access