Commit f6b38861 authored by VAN ZUIJLEN Nils's avatar VAN ZUIJLEN Nils
Browse files

Add tests for cotiz interaction with OrderItem.get_final_price

parent 47b235a4
...@@ -594,8 +594,23 @@ class OrderItemTest(OrderItemTestCase): ...@@ -594,8 +594,23 @@ class OrderItemTest(OrderItemTestCase):
oi.refresh_from_db() oi.refresh_from_db()
self.assertEqual(oi.get_final_price(), oi.get_price_contributor()) self.assertEqual(oi.get_final_price(), oi.get_price_contributor())
cotiz = self.create_item()
cotiz.action = "half_cotiz"
cotiz.save()
cotiz.add_to_order(self.order)
self.order.refresh_from_db()
oi.refresh_from_db()
self.assertEqual(oi.get_final_price(), oi.get_price_contributor())
def test_get_final_price_non_contributor(self) -> None: def test_get_final_price_non_contributor(self) -> None:
"""Tests OrderItem.get_final_price for a non contributor""" """
Tests OrderItem.get_final_price for a non contributor
Tests with and without a cotiz in the order
With cotiz should apply contributor price
"""
item = self.create_item() item = self.create_item()
oi = OrderItemTest.create_orderitem(self.order, item) oi = OrderItemTest.create_orderitem(self.order, item)
...@@ -606,6 +621,16 @@ class OrderItemTest(OrderItemTestCase): ...@@ -606,6 +621,16 @@ class OrderItemTest(OrderItemTestCase):
oi.refresh_from_db() oi.refresh_from_db()
self.assertEqual(oi.get_final_price(), oi.get_price()) self.assertEqual(oi.get_final_price(), oi.get_price())
cotiz = self.create_item()
cotiz.action = "half_cotiz"
cotiz.save()
cotiz.add_to_order(self.order)
self.order.refresh_from_db()
oi.refresh_from_db()
self.assertEqual(oi.get_final_price(), oi.get_price_contributor())
def test_post_payment(self) -> None: def test_post_payment(self) -> None:
item = self.create_item() item = self.create_item()
oi = self.create_orderitem(self.order, item) oi = self.create_orderitem(self.order, item)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment