fix: responsive
This commit is contained in:
@@ -75,7 +75,9 @@ class TestBackofficeProducts(TestCase, CreateProductsMixin):
|
||||
assert response.status_code == 302
|
||||
product = Product.objects.get(sku='NEW-3')
|
||||
price = ProductPrice.objects.get(product=product)
|
||||
assert price.price == Decimal('12.50')
|
||||
# 12.50 es el precio CON impuestos que introduce el staff; se guarda sin impuestos.
|
||||
assert price.price == Decimal('10.33')
|
||||
assert price.price_with_tax == Decimal('12.50')
|
||||
assert price.current is True
|
||||
|
||||
def test_create_product_with_price_missing_tax_shows_error(self):
|
||||
@@ -123,7 +125,7 @@ class TestBackofficeProducts(TestCase, CreateProductsMixin):
|
||||
|
||||
old_price.refresh_from_db()
|
||||
assert old_price.current is False
|
||||
new_price = self.product.prices.get(price=Decimal('25.00'))
|
||||
new_price = self.product.prices.get(price=Decimal('20.66'))
|
||||
assert new_price.current is True
|
||||
|
||||
def test_create_variant_for_product(self):
|
||||
@@ -150,6 +152,7 @@ class TestBackofficeProducts(TestCase, CreateProductsMixin):
|
||||
assert not ProductVariant.objects.filter(sku='V-M2').exists()
|
||||
|
||||
def test_create_price_for_product(self):
|
||||
# El staff introduce el precio CON impuestos; se guarda sin impuestos.
|
||||
tax, created = Tax.objects.get_or_create(code='IVA', value=21)
|
||||
|
||||
response = self.client.post(
|
||||
@@ -157,7 +160,9 @@ class TestBackofficeProducts(TestCase, CreateProductsMixin):
|
||||
{'price': '9.99', 'tax': tax.pk, 'current': 'on'},
|
||||
)
|
||||
assert response.status_code == 302
|
||||
assert ProductPrice.objects.filter(product=self.product, price=Decimal('9.99')).exists()
|
||||
price = ProductPrice.objects.get(product=self.product, current=True)
|
||||
assert price.price == Decimal('8.26')
|
||||
assert price.price_with_tax == Decimal('9.99')
|
||||
|
||||
def test_create_price_for_variant(self):
|
||||
tax, created = Tax.objects.get_or_create(code='IVA', value=21)
|
||||
@@ -169,7 +174,9 @@ class TestBackofficeProducts(TestCase, CreateProductsMixin):
|
||||
{'price': '19.99', 'tax': tax.pk, 'current': 'on'},
|
||||
)
|
||||
assert response.status_code == 302
|
||||
assert ProductPrice.objects.filter(variant=variant, price=Decimal('19.99')).exists()
|
||||
price = ProductPrice.objects.get(variant=variant, current=True)
|
||||
assert price.price == Decimal('16.52')
|
||||
assert price.price_with_tax == Decimal('19.99')
|
||||
|
||||
def create_image_file(self, name='test.webp'):
|
||||
image = Image.new('RGB', (256, 256), '#ACACAC')
|
||||
|
||||
Reference in New Issue
Block a user