# Path: brasilcomvc/feedback/models.py
# class Feedback(models.Model):
# 
#     email = models.EmailField()
#     question_1 = models.BooleanField(QUESTIONS[0], default=False)
#     question_2 = models.BooleanField(QUESTIONS[1], default=False)
#     question_3 = models.BooleanField(QUESTIONS[2], default=False)
#     question_4 = models.BooleanField(QUESTIONS[3], default=False)
#     question_5 = models.BooleanField(QUESTIONS[4], default=False)
#     comments = models.TextField(default='')
# 
#     created = models.DateTimeField(auto_now_add=True)
#     updated = models.DateTimeField(auto_now=True)
# 
#     comments.verbose_name = 'comentários'
# 
#     def __str__(self):
#         return '{} - {}'.format(self.email, self.created)
# 
#     def __unicode__(self):
#         return '{} - {}'.format(self.email, self.created)


from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from ..models import Feedback
        self.client.cookies[settings.SESSION_COOKIE_NAME] = 'fake'
        session = self.client.session
        session['deleted_email'] = 'test@domain.net'
        session.save()
        self.client.cookies[settings.SESSION_COOKIE_NAME] = session.session_key

    def test_template_used(self):
        self._setup_session()

        resp = self.client.get(self.url)
        self.assertEqual(resp.status_code, 200)
        self.assertTemplateUsed(resp, 'feedback/create.html')

    def test_feedback_creation(self):
        self._setup_session()

        data = {
            'question_1': 'on',
            'question_2': 'on',
            'question_3': '',
            'question_4': 'on',
            'question_5': '',
            'comments': 'A nice comment',
        }

        next_url = reverse('feedback:create')
        resp = self.client.post('{}?next={}'.format(self.url, next_url), data)
        self.assertRedirects(resp, next_url)

        self.assertEqual(Feedback.objects.count(), 1)

# Path: brasilcomvc/feedback/models.py
# class Feedback(models.Model):
# 
#     email = models.EmailField()
#     question_1 = models.BooleanField(QUESTIONS[0], default=False)
#     question_2 = models.BooleanField(QUESTIONS[1], default=False)
#     question_3 = models.BooleanField(QUESTIONS[2], default=False)
#     question_4 = models.BooleanField(QUESTIONS[3], default=False)
#     question_5 = models.BooleanField(QUESTIONS[4], default=False)
#     comments = models.TextField(default='')
# 
#     created = models.DateTimeField(auto_now_add=True)
#     updated = models.DateTimeField(auto_now=True)
# 
#     comments.verbose_name = 'comentários'
# 
#     def __str__(self):
#         return '{} - {}'.format(self.email, self.created)
# 
#     def __unicode__(self):
#         return '{} - {}'.format(self.email, self.created)


# Path: brasilcomvc/feedback/tests/test_views.py
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from ..models import Feedback

        self.client.cookies[settings.SESSION_COOKIE_NAME] = 'fake'
        session = self.client.session
        session['deleted_email'] = 'test@domain.net'
        session.save()
        self.client.cookies[settings.SESSION_COOKIE_NAME] = session.session_key

    def test_template_used(self):
        self._setup_session()

        resp = self.client.get(self.url)
        self.assertEqual(resp.status_code, 200)
        self.assertTemplateUsed(resp, 'feedback/create.html')

    def test_feedback_creation(self):
        self._setup_session()

        data = {
            'question_1': 'on',
            'question_2': 'on',
            'question_3': '',
            'question_4': 'on',
            'question_5': '',
            'comments': 'A nice comment',
        }

        next_url = reverse('feedback:create')
        resp = self.client.post('{}?next={}'.format(self.url, next_url), data)
        self.assertRedirects(resp, next_url)

        self.assertEqual(Feedback.objects.count(), 1)

        feedback = Feedback.objects.get()