def _create_and_verify_order(self, sku): response = self._order(sku) # Verify that the orders endpoint has successfully created the order self.assertEqual(response.status_code, status.HTTP_200_OK) # Verify that the order data in the response is valid response_serializer = OrderSerializer(data=response.data) self.assertTrue(response_serializer.is_valid(), msg=response_serializer.errors) # Verify that the returned order metadata lines up with the order in the system expected_serializer = OrderSerializer(Order.objects.get()) self.assertEqual(response_serializer.data, expected_serializer.data)
def _create_and_verify_order(self, sku, shipping_event_name): # Ideally, we'd use Oscar's ShippingEventTypeFactory here, but it's not exposed/public. ShippingEventType.objects.create(name=shipping_event_name) response = self._order(sku=sku) # Verify that the orders endpoint has successfully created the order self.assertEqual(response.status_code, status.HTTP_200_OK) # Verify that the order data in the response is valid response_serializer = OrderSerializer(data=response.data) self.assertTrue(response_serializer.is_valid(), msg=response_serializer.errors) # Verify that the returned order metadata lines up with the order in the system expected_serializer = OrderSerializer(Order.objects.get()) self.assertEqual(response_serializer.data, expected_serializer.data)