From 4affc08eae3b22701b32c7787d8400ad0e1212e7 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 8 Nov 2016 14:47:32 +0100 Subject: [PATCH] test with non-rounded values for diy-frame prices --- api/lib/prices.py | 4 ++-- api/resources/prices.py | 4 ++-- tests/resources/test_prices.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/lib/prices.py b/api/lib/prices.py index 754c646..d3fa838 100644 --- a/api/lib/prices.py +++ b/api/lib/prices.py @@ -149,12 +149,12 @@ def canvas_frame_price(width, height, stock_price, market, additional_price=None return price -def old_canvas_diy_frame_price(width, height, market, reseller=None, inc_vat=True): +def old_canvas_diy_frame_price(width, height, market, reseller=None, rounded=True, inc_vat=True): # todo: when product models are in place we should use stockproduct ""Do it yourself frame"" # instead of hardcoded values stock_price = 1.61084 additional_price = 94.750000 - return canvas_frame_price(width, height, stock_price, market, additional_price, reseller=reseller, rounded=True, inc_vat=inc_vat) + return canvas_frame_price(width, height, stock_price, market, additional_price, reseller=reseller, rounded=rounded, inc_vat=inc_vat) def old_canvas_price(width, height, material, market, framed=True, designer=None, reseller=None, inc_vat=True): diff --git a/api/resources/prices.py b/api/resources/prices.py index b240895..bee0366 100644 --- a/api/resources/prices.py +++ b/api/resources/prices.py @@ -86,8 +86,8 @@ def diy_frame(): data = [{ 'width': width, 'height': height, - 'price': old_canvas_diy_frame_price(width, height, market, reseller=reseller), - 'price_excl_vat': old_canvas_diy_frame_price(width, height, market, reseller=reseller, inc_vat=False) + 'price': old_canvas_diy_frame_price(width, height, market, reseller=reseller, rounded=False), + 'price_excl_vat': old_canvas_diy_frame_price(width, height, market, reseller=reseller, rounded=False, inc_vat=False) }] return jsonify(data=data) diff --git a/tests/resources/test_prices.py b/tests/resources/test_prices.py index 659e392..31621b6 100644 --- a/tests/resources/test_prices.py +++ b/tests/resources/test_prices.py @@ -56,4 +56,4 @@ class TestEndpoints(flask_testing.TestCase): product = response.json['data'][0] self.assertEqual(150, product['width'], "it adjusts measurements") self.assertEqual(50, product['height']) - self.assertEqual(924, product['price']) + self.assertAlmostEqual(923.857, product['price'], places=2)