# Path: test_projects/django18/pizzagigi/models.py
# class Pizza(models.Model):
#     """Pizza demonstrates minimal use-case"""
# 
#     ANCHOVIES = 'a'
#     BLACK_OLIVES = 'b'
#     CHEDDAR_CHEESE = 'c'
#     EGG = 'e'
#     PANCETTA = 'pk'
#     PEPPERONI = 'p'
#     PROSCIUTTO_CRUDO = 'P'
#     MOZZARELLA = 'm'
#     MUSHROOMS = 'M'
#     TOMATO = 't'
#     TOPPING_CHOICES = (
#         (ANCHOVIES, _('Anchovies')),
#         (BLACK_OLIVES, _('Black olives')),
#         (CHEDDAR_CHEESE, _('Cheddar cheese')),
#         (EGG, _('Eggs')),
#         (PANCETTA, _('Pancetta')),
#         (PEPPERONI, _('Pepperoni')),
#         (PROSCIUTTO_CRUDO, _('Prosciutto crudo')),
#         (MOZZARELLA, _('Mozzarella')),
#         (MUSHROOMS, _('Mushrooms')),
#         (TOMATO, _('Tomato')),
#     )
# 
#     toppings = SelectMultipleField(
#         max_length=10,
#         choices=TOPPING_CHOICES
#     )
# 
#     def get_toppings(self):
#         if self.toppings:
#             keys_choices = self.toppings
#             return '%s' % (', '.join(filter(bool, keys_choices)))
#     get_toppings.short_description = _('Toppings')
# 
#     def __str__(self):
#         return "pk=%s" % force_text(self.pk)
# 
#     def get_absolute_url(self):
#         return reverse('pizza:detail', args=[self.pk])
# 
# def show_topping(ingredient):
#     """
#     Decode topping to full name
#     """
#     decoder = dict(Pizza.TOPPING_CHOICES)
#     return force_text(decoder[ingredient])


import json
from django.core import serializers
from django.core.urlresolvers import reverse
from django.test import SimpleTestCase, TestCase
from django.utils.datastructures import MultiValueDict
from django.utils.http import urlencode
from .models import Pizza, show_topping
# -*- coding: utf-8 -*-
from __future__ import unicode_literals





class PizzaListViewTestCase(TestCase):

    def test_no_pizzas(self):
        p = Pizza.objects.all()
        self.assertEqual(len(p), 0, 'Test requires no pizzas')
        response = self.client.get(reverse('pizza:list'))
        self.assertEqual(response.status_code, 200)
        self.assertTrue('No pizzas found' in response.content.decode('utf-8'))

    def test_many_pizzas(self):
        NUM_PIZZAS = 30
        pizzas = []
        for n in range(NUM_PIZZAS):
            p = Pizza.objects.create(toppings=[Pizza.PEPPERONI])
            pizzas.append(p)

        self.assertEqual(len(pizzas), NUM_PIZZAS, 'Test requires pizzas')
        response = self.client.get(reverse('pizza:list'))
        self.assertEqual(response.status_code, 200)
        self.assertTrue(

# Path: test_projects/django18/pizzagigi/models.py
# class Pizza(models.Model):
#     """Pizza demonstrates minimal use-case"""
# 
#     ANCHOVIES = 'a'
#     BLACK_OLIVES = 'b'
#     CHEDDAR_CHEESE = 'c'
#     EGG = 'e'
#     PANCETTA = 'pk'
#     PEPPERONI = 'p'
#     PROSCIUTTO_CRUDO = 'P'
#     MOZZARELLA = 'm'
#     MUSHROOMS = 'M'
#     TOMATO = 't'
#     TOPPING_CHOICES = (
#         (ANCHOVIES, _('Anchovies')),
#         (BLACK_OLIVES, _('Black olives')),
#         (CHEDDAR_CHEESE, _('Cheddar cheese')),
#         (EGG, _('Eggs')),
#         (PANCETTA, _('Pancetta')),
#         (PEPPERONI, _('Pepperoni')),
#         (PROSCIUTTO_CRUDO, _('Prosciutto crudo')),
#         (MOZZARELLA, _('Mozzarella')),
#         (MUSHROOMS, _('Mushrooms')),
#         (TOMATO, _('Tomato')),
#     )
# 
#     toppings = SelectMultipleField(
#         max_length=10,
#         choices=TOPPING_CHOICES
#     )
# 
#     def get_toppings(self):
#         if self.toppings:
#             keys_choices = self.toppings
#             return '%s' % (', '.join(filter(bool, keys_choices)))
#     get_toppings.short_description = _('Toppings')
# 
#     def __str__(self):
#         return "pk=%s" % force_text(self.pk)
# 
#     def get_absolute_url(self):
#         return reverse('pizza:detail', args=[self.pk])
# 
# def show_topping(ingredient):
#     """
#     Decode topping to full name
#     """
#     decoder = dict(Pizza.TOPPING_CHOICES)
#     return force_text(decoder[ingredient])


# Path: test_projects/django18/pizzagigi/tests.py
import json
from django.core import serializers
from django.core.urlresolvers import reverse
from django.test import SimpleTestCase, TestCase
from django.utils.datastructures import MultiValueDict
from django.utils.http import urlencode
from .models import Pizza, show_topping

# -*- coding: utf-8 -*-
from __future__ import unicode_literals





class PizzaListViewTestCase(TestCase):

    def test_no_pizzas(self):
        p = Pizza.objects.all()
        self.assertEqual(len(p), 0, 'Test requires no pizzas')
        response = self.client.get(reverse('pizza:list'))
        self.assertEqual(response.status_code, 200)
        self.assertTrue('No pizzas found' in response.content.decode('utf-8'))

    def test_many_pizzas(self):
        NUM_PIZZAS = 30
        pizzas = []
        for n in range(NUM_PIZZAS):
            p = Pizza.objects.create(toppings=[Pizza.PEPPERONI])
            pizzas.append(p)

        self.assertEqual(len(pizzas), NUM_PIZZAS, 'Test requires pizzas')
        response = self.client.get(reverse('pizza:list'))
        self.assertEqual(response.status_code, 200)
        self.assertTrue(

            show_topping(Pizza.PEPPERONI) in response.content.decode('utf-8'))