Skip to content

Commit

Permalink
feat ⭐ add test to check saving multiple products with same new produ…
Browse files Browse the repository at this point in the history
…ct class
  • Loading branch information
samar-hassan committed Aug 9, 2024
1 parent 1a3b90c commit 4823be1
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion tests/reverse/test_catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ def test_error_handling_on_product_operations(self):
)


class SingleProductFieldsToUpdateTest(TestCase):
class ProductFieldsToUpdateTest(TestCase):
def setUp(self):
super().setUp()
ProductClass.objects.create(
Expand Down Expand Up @@ -953,3 +953,33 @@ def test_product_class_fields_to_update(self):
prd.refresh_from_db()
# Product class is updated as it was added in fields_to_update
self.assertEqual(prd.product_class.requires_shipping, True)

def test_check_multiple_products_with_same_new_product_class(self):
product_resources = [
ProductResource(
upc="checking",
title="Checking",
slug="checking",
structure=Product.STANDALONE,
product_class=ProductClassResource(
name="Better",
slug="better",
requires_shipping=False,
track_stock=True,
),
),
ProductResource(
upc="testing",
title="Testing",
slug="testing",
structure=Product.STANDALONE,
product_class=ProductClassResource(
name="Better",
slug="better",
requires_shipping=False,
track_stock=True,
),
),
]
_, errors = products_to_db(product_resources)
self.assertEqual(len(errors), 0)

0 comments on commit 4823be1

Please sign in to comment.