added test for sell price breaks

This commit is contained in:
Matthias 2021-06-13 13:31:31 +02:00
parent 74c4c559e4
commit 3fb95bea7e
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,17 @@
# Sell price breaks for parts
# Price breaks for R_2K2_0805
- model: part.partsellpricebreak
pk: 1
fields:
part: 3
quantity: 1
price: 0.15
- model: part.partsellpricebreak
pk: 2
fields:
part: 3
quantity: 10
price: 0.10

View File

@ -51,6 +51,7 @@ class PartTest(TestCase):
'category',
'part',
'location',
'part_pricebreaks'
]
def setUp(self):
@ -113,6 +114,13 @@ class PartTest(TestCase):
self.assertTrue(len(matches) > 0)
def test_sell_pricing(self):
# check that the sell pricebreaks were loaded
self.assertTrue(self.r1.has_price_breaks)
self.assertEqual(self.r1.price_breaks.count(), 2)
# check that the sell pricebreaks work
self.assertEqual(float(self.r1.get_price(1)), 0.15)
self.assertEqual(float(self.r1.get_price(10)), 1.0)
class TestTemplateTest(TestCase):