# Path: common/tests/base.py
# class BaseTestCase(TestCase):
#     """
#     base test case class for common stuff and utilities 
#     to be used by test cases of other modules
#     """
# 
#     def setUp(self):
# 
#         # creating user
#         self.username = 'neobytes'
#         self.password = 'neopass'
#         self.user = User.objects.create_user(self.username, 'neobytes@abcdomain.com', self.password)
# 
# Path: common/models.py
# class Product(models.Model):
#     """
#     product model for the items etc.
#     """
#     name = models.CharField(max_length=64)
#     description = models.CharField(max_length=1024, unique=True)
#     wholesale_price = models.PositiveIntegerField(default=0)
#     retail_price = models.PositiveIntegerField(default=0)
#     img = models.ImageField(upload_to = 'prod_imgs/', default = 'prod_imgs/default.png')
#     created_at = models.DateTimeField(auto_now_add=True)
# 
#     def __unicode__(self):
#         """
#         function returns unicode representation of a product
#         """
#         return self.name


from .base import BaseTestCase
from common.models import Product

class ProductTestCase(BaseTestCase):
    def setUp(self):
        """
        create a test product test cases
        """

        super(ProductTestCase, self).setUp()

        # creating dummy product
        self.product = Product()
        self.product.name = "Table"
        self.product.description = 'Wooden table for future erp workers'
        self.product.wholesale_price = 1200
        self.product.retail_price = 1500
        self.product.save()

    def test_product_was_added(self):
        """
        ensure that product was added
        """

# Path: common/tests/base.py
# class BaseTestCase(TestCase):
#     """
#     base test case class for common stuff and utilities 
#     to be used by test cases of other modules
#     """
# 
#     def setUp(self):
# 
#         # creating user
#         self.username = 'neobytes'
#         self.password = 'neopass'
#         self.user = User.objects.create_user(self.username, 'neobytes@abcdomain.com', self.password)
# 
# Path: common/models.py
# class Product(models.Model):
#     """
#     product model for the items etc.
#     """
#     name = models.CharField(max_length=64)
#     description = models.CharField(max_length=1024, unique=True)
#     wholesale_price = models.PositiveIntegerField(default=0)
#     retail_price = models.PositiveIntegerField(default=0)
#     img = models.ImageField(upload_to = 'prod_imgs/', default = 'prod_imgs/default.png')
#     created_at = models.DateTimeField(auto_now_add=True)
# 
#     def __unicode__(self):
#         """
#         function returns unicode representation of a product
#         """
#         return self.name


# Path: common/tests/test_products.py
from .base import BaseTestCase
from common.models import Product


class ProductTestCase(BaseTestCase):
    def setUp(self):
        """
        create a test product test cases
        """

        super(ProductTestCase, self).setUp()

        # creating dummy product
        self.product = Product()
        self.product.name = "Table"
        self.product.description = 'Wooden table for future erp workers'
        self.product.wholesale_price = 1200
        self.product.retail_price = 1500
        self.product.save()

    def test_product_was_added(self):
        """
        ensure that product was added
        """

        table = Product.objects.get(name="Table")