Skip to content

Commit

Permalink
Add test case for product creation
Browse files Browse the repository at this point in the history
  • Loading branch information
vijoin committed Dec 14, 2023
1 parent 696843b commit 9c2c279
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion products/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
from django.test import TestCase
from .models import Product, ProductBrand, ProductCategory

# Create your tests here.

class ProductTest(TestCase):
def setUp(self):
brand = ProductBrand.objects.create(name="Brand1", description="Brand1")
category = ProductCategory.objects.create(name="Category1", description="Category1")
Product.objects.create(name="Product1", brand=brand, category=category)

def test_product_is_created(self):
product = Product.objects.get(name="Product1")
self.assertEqual(product.name, "Product1")
self.assertEqual(product.brand.name, "Brand1")
self.assertEqual(product.category.name, "Category1")

0 comments on commit 9c2c279

Please sign in to comment.