PW-680 fixed a bug where exchange_rate and price_adjustments didnt reload properly between requests
This commit is contained in:
+15
-15
@@ -74,26 +74,26 @@ class Market(object):
|
||||
|
||||
|
||||
_markets = [
|
||||
Market('Sweden', 'sv_SE', 'SEK', 1.25, 'SWE'),
|
||||
Market('Norway', 'nn_NO', 'NOK', 1.25, 'NOR'),
|
||||
Market('United kingdom', 'en_GB', 'GBP', 1.20, 'GBR'),
|
||||
Market('Denmark', 'da_DK', 'DKK', 1.25, 'DNK'),
|
||||
Market('Finland', 'fi_FI', 'EUR', 1.24, 'FIN'),
|
||||
Market('Russia', 'ru_RU', 'EUR', 1, 'RUS'),
|
||||
Market('Germany', 'de_DE', 'EUR', 1.19, 'DEU'),
|
||||
Market('Netherlands', 'nl_NL', 'EUR', 1.21, 'NLD'),
|
||||
Market('Austria', 'de_AT', 'EUR', 1.20, 'AUT'),
|
||||
Market('USA', 'en_US', 'USD', 1, 'USA'),
|
||||
Market('Spain', 'es_ES', 'EUR', 1.25, 'ESP'),
|
||||
Market('France', 'fr_FR', 'EUR', 1.20, 'FRA'),
|
||||
Market('Poland', 'pl_PL', 'PLN', 1.25, 'POL'),
|
||||
Market('International', 'en_EU', 'EUR', 1.25, None),
|
||||
('Sweden', 'sv_SE', 'SEK', 1.25, 'SWE'),
|
||||
('Norway', 'nn_NO', 'NOK', 1.25, 'NOR'),
|
||||
('United kingdom', 'en_GB', 'GBP', 1.20, 'GBR'),
|
||||
('Denmark', 'da_DK', 'DKK', 1.25, 'DNK'),
|
||||
('Finland', 'fi_FI', 'EUR', 1.24, 'FIN'),
|
||||
('Russia', 'ru_RU', 'EUR', 1, 'RUS'),
|
||||
('Germany', 'de_DE', 'EUR', 1.19, 'DEU'),
|
||||
('Netherlands', 'nl_NL', 'EUR', 1.21, 'NLD'),
|
||||
('Austria', 'de_AT', 'EUR', 1.20, 'AUT'),
|
||||
('USA', 'en_US', 'USD', 1, 'USA'),
|
||||
('Spain', 'es_ES', 'EUR', 1.25, 'ESP'),
|
||||
('France', 'fr_FR', 'EUR', 1.20, 'FRA'),
|
||||
('Poland', 'pl_PL', 'PLN', 1.25, 'POL'),
|
||||
('International', 'en_EU', 'EUR', 1.25, None),
|
||||
]
|
||||
|
||||
|
||||
def iter_markets():
|
||||
for market in _markets:
|
||||
yield market
|
||||
yield Market(*market)
|
||||
|
||||
|
||||
def from_locale(locale):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# coding=UTF-8
|
||||
|
||||
import unittest2
|
||||
import mock
|
||||
from api.lib.prices import *
|
||||
from tests.factories import DesignerFactory, ContractCustomerFactory, InquiryFactory
|
||||
from api.models import market
|
||||
@@ -169,7 +170,9 @@ class TestPrice(unittest2.TestCase):
|
||||
self.assertEqual(111, old_canvas_price(width=100, height=100, material=standard_canvas, market=russia, framed=False,
|
||||
designer=designer_moomin, reseller=piterra))
|
||||
|
||||
|
||||
def test_wallpaper_custom_inquiry_price(self):
|
||||
with mock.patch.object(Inquiry, 'market', nl):
|
||||
inquiry = Inquiry(product_group="photo-wallpaper", territory="NL", pricepremium=0,
|
||||
width=350, height=270, price_effect=0, price_retouch=160.00, material=standard_wallpaper)
|
||||
|
||||
@@ -190,6 +193,7 @@ class TestPrice(unittest2.TestCase):
|
||||
designer = DesignerFactory()
|
||||
designer.pricepremium = 4
|
||||
product = Product(designer=designer)
|
||||
with mock.patch.object(Inquiry, 'market', sweden):
|
||||
inquiry = Inquiry(product_group="photo-wallpaper", territory="SE", pricepremium=0,
|
||||
width=350, height=280, price_retouch=0, material=standard_wallpaper, product=product)
|
||||
|
||||
@@ -202,6 +206,7 @@ class TestPrice(unittest2.TestCase):
|
||||
designer = DesignerFactory()
|
||||
designer.pricepremium = 4
|
||||
product = Product(designer=designer)
|
||||
with mock.patch.object(Inquiry, 'market', sweden):
|
||||
inquiry = Inquiry(product_group="photo-wallpaper", territory="SE", pricepremium=25,
|
||||
width=250, height=400, price_retouch=200, material=standard_wallpaper, product=product)
|
||||
|
||||
@@ -212,6 +217,7 @@ class TestPrice(unittest2.TestCase):
|
||||
|
||||
def test_wallpaper_piterra_inquiry_price(self):
|
||||
product = Product(designer=None)
|
||||
with mock.patch.object(Inquiry, 'market', russia):
|
||||
inquiry = Inquiry(product_group="photo-wallpaper", territory="RU", width=150, height=211, dealer_store=piterra, pricepremium=36.029411,
|
||||
material=standard_wallpaper, product=product)
|
||||
|
||||
@@ -220,6 +226,7 @@ class TestPrice(unittest2.TestCase):
|
||||
inquiry, inc_price_retouch=False, material=premium_wallpaper))
|
||||
|
||||
def test_canvas_custom_inquiry_price(self):
|
||||
with mock.patch.object(Inquiry, 'market', sweden):
|
||||
inquiry = Inquiry(product_group='canvas', territory='SE', width=100, height=100,
|
||||
framed=True, price_retouch=200, pricepremium=0, material=standard_canvas)
|
||||
|
||||
@@ -229,6 +236,7 @@ class TestPrice(unittest2.TestCase):
|
||||
inquiry, inc_price_retouch=False, framed=False))
|
||||
|
||||
def test_canvas_piterra_inquiry_price(self):
|
||||
with mock.patch.object(Inquiry, 'market', russia):
|
||||
inquiry = Inquiry(product_group='canvas', territory='RU', width=100, height=100,
|
||||
framed=True, dealer_store=piterra, pricepremium=0, material=standard_canvas)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user