P5-4394 add framed-prints price formulas

This commit is contained in:
Martin
2019-10-31 14:16:22 +01:00
parent 0dd8d619b4
commit 95a264af99
5 changed files with 132 additions and 0 deletions
+18
View File
@@ -543,3 +543,21 @@ class TestPrice(unittest2.TestCase):
self.assertEqual(
250, inquiry_price(inquiry, inc_price_retouch=False, hanger=False)
)
def test_framed_print_price(self):
self.assertEqual(558, framed_print_price(sku="GLOBAL-CFP-12x12", market=sweden))
self.assertEqual(
569,
framed_print_price(
sku="GLOBAL-CFP-12x12", market=sweden, designer=designer_moomin
),
)
self.assertEqual(
528, framed_print_price(sku="GLOBAL-CFP-12x12", market=denmark)
)
def test_invalid_framed_print_code(self):
with self.assertRaises(ValueError) as context:
framed_print_price(sku="invalid", market=sweden)
self.assertTrue("Invalid SKU number" in str(context.exception))
+8
View File
@@ -201,3 +201,11 @@ class TestEndpoints(flask_testing.TestCase):
response = self.client.get("/prices/inquiry/1?width=100&height=100")
self.assert200(response)
self.assertEqual("poster", response.json["group"])
def test_framed_print(self):
response = self.client.get(
"/prices/framed-print?sku=GLOBAL-CFP-12x12&territory=SE"
)
self.assert200(response)
expected = [{"price": 557.5, "price_excl_vat": 446, "sku": "GLOBAL-CFP-12x12"}]
self.assertEqual(expected, response.json["data"])