# Path: tests/catalog/models.py
# def create_product(name, unit_price=100, **kwargs):
#     filters = {
#         'name': name,
#         'slug': slugify(name),
#         'upc': slugify(name),
#         'unit_price': D(unit_price),
#     }
#     filters.update(kwargs)
#     return Product.objects.language().create(**filters)
# 
# def create_category(name, **kwargs):
#     return create_categorization(Category, name, **kwargs)
# 
# def create_brand(name, **kwargs):
#     return create_categorization(Brand, name, **kwargs)
# 
# def create_manufacturer(name, **kwargs):
#     return create_categorization(Manufacturer, name, **kwargs)


from django.test import TestCase
from django.core.urlresolvers import reverse
from .models import (
    create_product, create_category, create_brand, create_manufacturer)
        create_product('P1', category=cat_1, brand=bra_1, manufacturer=man_1)
        create_product('P2', category=cat_1, brand=bra_1)
        create_product('P3', category=cat_1)

        self.resp_1 = self.get_products_response(
            category='cat-1', brand='bra-1', manufacturer='man-1')
        self.resp_2 = self.get_products_response(
            category='cat-1', brand='bra-empty')
        self.resp_3 = self.get_products_response(category='cat-non-existant')

    def get_products_response(self, **kwargs):
        return self.client.get(self.products_url, kwargs)

    def test_get_categorization_filters(self):
        self.assertEquals(len(self.resp_1.context['object_list']), 1)
        self.assertEquals(len(self.resp_2.context['object_list']), 0)

        # Category doesn't exists so return all.
        self.assertEquals(len(self.resp_3.context['object_list']), 3)

    def test_get_price_filters(self):
        pass

    def test_get_date_filters(self):
        pass

    def test_search_products(self):
        pass

    def test_sort_products(self):

# Path: tests/catalog/models.py
# def create_product(name, unit_price=100, **kwargs):
#     filters = {
#         'name': name,
#         'slug': slugify(name),
#         'upc': slugify(name),
#         'unit_price': D(unit_price),
#     }
#     filters.update(kwargs)
#     return Product.objects.language().create(**filters)
# 
# def create_category(name, **kwargs):
#     return create_categorization(Category, name, **kwargs)
# 
# def create_brand(name, **kwargs):
#     return create_categorization(Brand, name, **kwargs)
# 
# def create_manufacturer(name, **kwargs):
#     return create_categorization(Manufacturer, name, **kwargs)


# Path: tests/catalog/views.py
from django.test import TestCase
from django.core.urlresolvers import reverse
from .models import (
    create_product, create_category, create_brand, create_manufacturer)

        create_product('P1', category=cat_1, brand=bra_1, manufacturer=man_1)
        create_product('P2', category=cat_1, brand=bra_1)
        create_product('P3', category=cat_1)

        self.resp_1 = self.get_products_response(
            category='cat-1', brand='bra-1', manufacturer='man-1')
        self.resp_2 = self.get_products_response(
            category='cat-1', brand='bra-empty')
        self.resp_3 = self.get_products_response(category='cat-non-existant')

    def get_products_response(self, **kwargs):
        return self.client.get(self.products_url, kwargs)

    def test_get_categorization_filters(self):
        self.assertEquals(len(self.resp_1.context['object_list']), 1)
        self.assertEquals(len(self.resp_2.context['object_list']), 0)

        # Category doesn't exists so return all.
        self.assertEquals(len(self.resp_3.context['object_list']), 3)

    def test_get_price_filters(self):
        pass

    def test_get_date_filters(self):
        pass

    def test_search_products(self):
        pass

    def test_sort_products(self):

        pass