PW-721 new canvas price formula

This commit is contained in:
Martin
2017-05-03 18:32:55 +02:00
parent 4c7ab37a21
commit 7e3c2c3c41
5 changed files with 108 additions and 176 deletions
+21 -31
View File
@@ -98,34 +98,28 @@ class TestEndpoints(flask_testing.TestCase):
self.assertEqual(expected, response.json['data'])
def test_canvas(self):
self._add_material('standard-canvas', 2, 79920)
response = self.client.get(
'/prices/canvas?width=200&height=10&territory=SE')
self.assert200(response)
expected = [
{
'price_excl_vat': 970.3471312000001,
'price': 1212.9339140000002,
'width': 150,
'height': 40,
'framed': True,
'm2_price': 999.0,
'm2_price_excl_vat': 799.2,
"framed": True,
"height": 40,
"price": 1008.0,
"price_excl_vat": 806.4,
"width": 150
},
{
'price_excl_vat': 319.68000000000006,
'price': 399.6000000000001,
'width': 200,
'height': 20,
'framed': False,
'm2_price': 999.0,
'm2_price_excl_vat': 799.2,
"framed": False,
"height": 20,
"price": 575.47,
"price_excl_vat": 460.37600000000003,
"width": 200
}
]
self.assertEqual(expected, response.json['data'])
def test_canvas_with_product(self):
self._add_material('standard-canvas', 2, 79920)
designer = self._add_designer(4)
product = self._add_product(designer)
response = self.client.get(
@@ -133,22 +127,18 @@ class TestEndpoints(flask_testing.TestCase):
self.assert200(response)
expected = [
{
'height': 40,
'price_excl_vat': 989.5279312000002,
'price': 1236.9099140000003,
'framed': True,
'm2_price': 1038.96,
'm2_price_excl_vat': 831.1680000000001,
'width': 150
"framed": True,
"height": 40,
"price": 1048.32,
"price_excl_vat": 838.656,
"width": 150
},
{
'height': 20,
'price_excl_vat': 332.46720000000005,
'price': 415.58400000000006,
'framed': False,
'm2_price': 1038.96,
'm2_price_excl_vat': 831.1680000000001,
'width': 200
"framed": False,
"height": 20,
"price": 598.4888000000001,
"price_excl_vat": 478.79104000000007,
"width": 200
}
]
self.assertEqual(expected, response.json['data'])
@@ -160,7 +150,7 @@ class TestEndpoints(flask_testing.TestCase):
product = response.json['data'][0]
self.assertEqual(150, product['width'], "it adjusts measurements")
self.assertEqual(50, product['height'])
self.assertAlmostEqual(923.857, product['price'], places=2)
self.assertAlmostEqual(731.25, product['price'], places=2)
def test_inquiry_wallpaper(self):
self._add_material('standard-wallpaper', 1, 236)