def test_add_order(self):
        """Tests the general adding of an order via the add_order method
        """
        # check we have 2 addresses before the order
        self.assertEqual(4, Address.objects.count())

        order = add_order(self.request)

        # adding an order should deep copy our addresses above
        self.assertEqual(6, Address.objects.count())

        self.assertEqual(order.state, SUBMITTED)
        self.assertEqual("%.2f" % order.price, "9.80")
        self.assertEqual(order.tax % "%.2f", "1.56")

        self.assertEqual(order.shipping_method.name, "Standard")
        self.assertEqual(order.shipping_price, 1.0)
        self.assertEqual("%.2f" % order.shipping_tax, "0.16")

        self.assertEqual(order.payment_method.name, "Direct Debit")
        self.assertEqual(order.payment_price, 0.0)
        self.assertEqual(order.payment_tax, 0.0)

        self.assertEqual(order.shipping_address.firstname, "John")
        self.assertEqual(order.shipping_address.lastname, "Doe")
        self.assertEqual(order.shipping_address.line1, "Street 42")
        self.assertEqual(order.shipping_address.line2, None)
        self.assertEqual(order.shipping_address.city, "Gotham City")
        self.assertEqual(order.shipping_address.zip_code, "2342")
        self.assertEqual(order.shipping_address.phone, "555-111111")
        self.assertEqual(order.shipping_address.company_name, "Doe Ltd.")

        self.assertEqual(order.invoice_address.firstname, "Jane")
        self.assertEqual(order.invoice_address.lastname, "Doe")
        self.assertEqual(order.invoice_address.line1, "Street 43")
        self.assertEqual(order.invoice_address.line2, None)
        self.assertEqual(order.invoice_address.city, "Smallville")
        self.assertEqual(order.invoice_address.zip_code, "2443")
        self.assertEqual(order.invoice_address.phone, "666-111111")
        self.assertEqual(order.invoice_address.company_name, "Doe Ltd.")

        # Items
        self.assertEqual(len(order.items.all()), 2)

        item = order.items.all().order_by('id')[0]
        self.assertEqual(item.product_amount, 2)
        self.assertEqual(item.product_sku, "sku-1")
        self.assertEqual(item.product_name, "Product 1")
        self.assertEqual("%.2f" % item.product_price_gross, "1.10")
        self.assertEqual("%.2f" % item.product_price_net, "0.92")
        self.assertEqual("%.2f" % item.product_tax, "0.18")

        item = order.items.all().order_by('id')[1]
        self.assertEqual(item.product_amount, 3)
        self.assertEqual(item.product_sku, "sku-2")
        self.assertEqual(item.product_name, "Product 2")
        self.assertEqual("%.2f" % item.product_price_gross, "2.20")
        self.assertEqual("%.2f" % item.product_price_net, "1.85")
        self.assertEqual("%.2f" % item.product_tax, "0.35")

        # The cart should be deleted after the order has been created
        cart = cart_utils.get_cart(self.request)
        self.assertEqual(cart, None)

        # delivery time should of the selected shipping method should be saved with order
        self.assertTrue(order.delivery_time is not None)
dataset/ETHPy150Open diefenbach/django-lfs/lfs/order/tests.py/OrderTestCase.test_add_order/swapped operands of `%`