def test_order_found(self): """ If the order is located, the view should pass the data from the API. """ with mock_basket_order(basket_id=1, response=self.MOCK_ORDER): response = self.client.get(self.path) self.assertEqual(response.status_code, 200) actual = json.loads(response.content) self.assertEqual(actual, self.MOCK_ORDER)
def test_order_not_found(self): """ If the order is not found, the view should return a 404. """ with mock_basket_order(basket_id=1, exception=exceptions.HttpNotFoundError): response = self.client.get(self.path) self.assertEqual(response.status_code, 404)