# Path: deck/models.py
# class DeckBaseManager(models.QuerySet):
# class DeckBaseModel(models.Model):
#     class Meta:
# class Vote(models.Model):
#     class Meta:
# class Activity(DeckBaseModel):
#     class Meta:
# class Proposal(Activity):
#     class Meta:
# class Track(models.Model):
#     class Meta:
# class Event(DeckBaseModel):
#     class Meta:
#     def cached_authors(self):
#     def published_ones(self):
#     def upcoming(self, published_only=True):
#     def order_by_never_voted(self, user_id):
#     def __str__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
# def get_activities_by_parameters_order(ids):
#     def timetable(self):
#     def is_proposal(self):
#     def get_full_slides_url(self):
#     def save(self, *args, **kwargs):
#     def get_rate(self):
#     def rate(self, user, rate):
#     def user_already_voted(self, user):
#     def user_can_vote(self, user):
#     def user_can_approve(self, user):
#     def get_absolute_url(self):
#     def approve(self):
#     def disapprove(self):
#     def __str__(self):
#     def proposals(self):
#     def has_activities(self):
#     def add_proposal_to_slot(self, proposal, slot_index):
#     def add_activity_to_slot(self, activity, slot_index):
#     def refresh_track(self):
#     def closing_date_is_passed(self):
#     def closing_date_is_close(self):
#     def get_absolute_url(self):
#     def user_can_see_proposals(self, user):
#     def get_proposers_count(self):
#     def get_votes_count(self):
#     def get_votes_to_export(self):
#     def get_schedule(self):
#     def get_not_approved_schedule(self):
#     def get_main_track(self):
#     def filter_not_scheduled_by_slots(self):
#     def user_in_jury(self, user):
# def send_welcome_mail(request, user, **kwargs):
# def create_initial_jury(sender, instance, signal, created, **kwargs):
# def create_initial_track(sender, instance, signal, created, **kwargs):
# def send_proposal_deleted_mail(sender, instance, **kwargs):
#     ANGRY, SLEEPY, SAD, HAPPY, LAUGHING = range(-1, 4)
#     VOTE_TITLES = dict(
#         angry=_('Angry'), sad=_('Sad'),
#         sleepy=_('Sleepy'), happy=_('Happy'),
#         laughing=_('Laughing')
#     )
#     VOTE_RATES = ((ANGRY, 'angry'),
#                   (SAD, 'sad'),
#                   (SLEEPY, 'sleepy'),
#                   (HAPPY, 'happy'),
#                   (LAUGHING, 'laughing'))
#     PROPOSAL = 'proposal'
#     WORKSHOP = 'workshop'
#     OPENNING = 'openning'
#     COFFEEBREAK = 'coffee-break'
#     LUNCH = 'lunch'
#     LIGHTNINGTALKS = 'lightning-talks'
#     ENDING = 'ending'
#     ACTIVITY_TYPES = (
#         (PROPOSAL, _('Proposal')),
#         (WORKSHOP, _('Workshop')),
#         (OPENNING, _('Openning')),
#         (COFFEEBREAK, _('Coffee Break')),
#         (LUNCH, _('Lunch')),
#         (LIGHTNINGTALKS, _('Lightning Talks')),
#         (ENDING, _('Ending')),
#     )
# 
# Path: deck/tests/test_unit.py
# EVENT_DATA = {
#     'title': 'RuPy',
#     'slug': 'rupy',
#     'description': 'A really good event.',
#     'author_id': 1,
#     'is_published': False,
#     'slots': 30,
#     'closing_date': now() + timedelta(days=7),
# }
# 
# PROPOSAL_DATA = {
#     'title': 'Python For Zombies',
#     'slug': 'python-for-zombies',
#     'description': 'Brain...',
#     'author_id': 1,
#     'slides_url': 'jane_doe/talk'
# }
# 
# ANOTHER_PROPOSAL_DATA = {
#     'title': 'A Python 3 Metaprogramming Tutorial',
#     'slug': 'python-3-metaprogramming',
#     'description': 'An advanced tutorial on Python 3 and Metaprogramming',
#     'author_id': 1
# }


from collections import namedtuple
from django.conf import settings
from django.contrib.auth.models import User
from django.core import mail
from django.utils import six
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from django.utils.timezone import now, timedelta
from django.utils.translation import ugettext as _
from deck.models import (Event, Proposal, Vote, Jury,
                         send_proposal_deleted_mail, send_welcome_mail)
from deck.tests.test_unit import (
    EVENT_DATA, PROPOSAL_DATA, ANOTHER_PROPOSAL_DATA)
import datetime
import json

    def test_notify_event_creator_after_creation(self):
        if not settings.SEND_NOTIFICATIONS:
            return

        event_data = self.event_data.copy()
        event_data['closing_date'] = (
            event_data['closing_date'].strftime('%d/%m/%Y %H:%M')
        )
        with self.settings(LANGUAGE_CODE='pt-BR'):
            self.client.post(reverse('create_event'),
                             event_data, follow=True)
        event = Event.objects.get()

        self.assertEqual(1, len(mail.outbox))
        email = mail.outbox[0]
        self.assertIn(event.author.email, email.recipients())
        self.assertIn(settings.NO_REPLY_EMAIL, email.from_email)

    def test_create_event_with_jury(self):
        event_data = self.event_data.copy()
        event_data['closing_date'] = (
            event_data['closing_date'].strftime('%d/%m/%Y %H:%M')
        )
        with self.settings(LANGUAGE_CODE='pt-BR'):
            response = self.client.post(reverse('create_event'),
                                        event_data, follow=True)
        self.assertEquals(200, response.status_code)

        event = response.context['event']

# Path: deck/models.py
# class DeckBaseManager(models.QuerySet):
# class DeckBaseModel(models.Model):
#     class Meta:
# class Vote(models.Model):
#     class Meta:
# class Activity(DeckBaseModel):
#     class Meta:
# class Proposal(Activity):
#     class Meta:
# class Track(models.Model):
#     class Meta:
# class Event(DeckBaseModel):
#     class Meta:
#     def cached_authors(self):
#     def published_ones(self):
#     def upcoming(self, published_only=True):
#     def order_by_never_voted(self, user_id):
#     def __str__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
# def get_activities_by_parameters_order(ids):
#     def timetable(self):
#     def is_proposal(self):
#     def get_full_slides_url(self):
#     def save(self, *args, **kwargs):
#     def get_rate(self):
#     def rate(self, user, rate):
#     def user_already_voted(self, user):
#     def user_can_vote(self, user):
#     def user_can_approve(self, user):
#     def get_absolute_url(self):
#     def approve(self):
#     def disapprove(self):
#     def __str__(self):
#     def proposals(self):
#     def has_activities(self):
#     def add_proposal_to_slot(self, proposal, slot_index):
#     def add_activity_to_slot(self, activity, slot_index):
#     def refresh_track(self):
#     def closing_date_is_passed(self):
#     def closing_date_is_close(self):
#     def get_absolute_url(self):
#     def user_can_see_proposals(self, user):
#     def get_proposers_count(self):
#     def get_votes_count(self):
#     def get_votes_to_export(self):
#     def get_schedule(self):
#     def get_not_approved_schedule(self):
#     def get_main_track(self):
#     def filter_not_scheduled_by_slots(self):
#     def user_in_jury(self, user):
# def send_welcome_mail(request, user, **kwargs):
# def create_initial_jury(sender, instance, signal, created, **kwargs):
# def create_initial_track(sender, instance, signal, created, **kwargs):
# def send_proposal_deleted_mail(sender, instance, **kwargs):
#     ANGRY, SLEEPY, SAD, HAPPY, LAUGHING = range(-1, 4)
#     VOTE_TITLES = dict(
#         angry=_('Angry'), sad=_('Sad'),
#         sleepy=_('Sleepy'), happy=_('Happy'),
#         laughing=_('Laughing')
#     )
#     VOTE_RATES = ((ANGRY, 'angry'),
#                   (SAD, 'sad'),
#                   (SLEEPY, 'sleepy'),
#                   (HAPPY, 'happy'),
#                   (LAUGHING, 'laughing'))
#     PROPOSAL = 'proposal'
#     WORKSHOP = 'workshop'
#     OPENNING = 'openning'
#     COFFEEBREAK = 'coffee-break'
#     LUNCH = 'lunch'
#     LIGHTNINGTALKS = 'lightning-talks'
#     ENDING = 'ending'
#     ACTIVITY_TYPES = (
#         (PROPOSAL, _('Proposal')),
#         (WORKSHOP, _('Workshop')),
#         (OPENNING, _('Openning')),
#         (COFFEEBREAK, _('Coffee Break')),
#         (LUNCH, _('Lunch')),
#         (LIGHTNINGTALKS, _('Lightning Talks')),
#         (ENDING, _('Ending')),
#     )
# 
# Path: deck/tests/test_unit.py
# EVENT_DATA = {
#     'title': 'RuPy',
#     'slug': 'rupy',
#     'description': 'A really good event.',
#     'author_id': 1,
#     'is_published': False,
#     'slots': 30,
#     'closing_date': now() + timedelta(days=7),
# }
# 
# PROPOSAL_DATA = {
#     'title': 'Python For Zombies',
#     'slug': 'python-for-zombies',
#     'description': 'Brain...',
#     'author_id': 1,
#     'slides_url': 'jane_doe/talk'
# }
# 
# ANOTHER_PROPOSAL_DATA = {
#     'title': 'A Python 3 Metaprogramming Tutorial',
#     'slug': 'python-3-metaprogramming',
#     'description': 'An advanced tutorial on Python 3 and Metaprogramming',
#     'author_id': 1
# }


# Path: deck/tests/test_functional.py
from collections import namedtuple
from django.conf import settings
from django.contrib.auth.models import User
from django.core import mail
from django.utils import six
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from django.utils.timezone import now, timedelta
from django.utils.translation import ugettext as _
from deck.models import (Event, Proposal, Vote, Jury,
                         send_proposal_deleted_mail, send_welcome_mail)
from deck.tests.test_unit import (
    EVENT_DATA, PROPOSAL_DATA, ANOTHER_PROPOSAL_DATA)
import datetime
import json


    def test_notify_event_creator_after_creation(self):
        if not settings.SEND_NOTIFICATIONS:
            return

        event_data = self.event_data.copy()
        event_data['closing_date'] = (
            event_data['closing_date'].strftime('%d/%m/%Y %H:%M')
        )
        with self.settings(LANGUAGE_CODE='pt-BR'):
            self.client.post(reverse('create_event'),
                             event_data, follow=True)
        event = Event.objects.get()

        self.assertEqual(1, len(mail.outbox))
        email = mail.outbox[0]
        self.assertIn(event.author.email, email.recipients())
        self.assertIn(settings.NO_REPLY_EMAIL, email.from_email)

    def test_create_event_with_jury(self):
        event_data = self.event_data.copy()
        event_data['closing_date'] = (
            event_data['closing_date'].strftime('%d/%m/%Y %H:%M')
        )
        with self.settings(LANGUAGE_CODE='pt-BR'):
            response = self.client.post(reverse('create_event'),
                                        event_data, follow=True)
        self.assertEquals(200, response.status_code)

        event = response.context['event']

        self.assertEquals(Jury.objects.count(), 1)