# Path: podium/talks/models.py
# class Talk(models.Model):
#     speaker_name = models.CharField(max_length=1000)
#     speaker_email = models.CharField(max_length=1000)
#     title = models.CharField(max_length=1000)
#     description = models.TextField()
#     sessions_available = models.ManyToManyField(
#         'Session', related_name='talks_available')
#     status = models.CharField(
#         max_length=1, choices=TALK_STATUS_CHOICES,
#         default='S')
# 
#     def get_absolute_url(self):
#         return reverse('talks-talk-id', args=[self.id])
# 
#     def __str__(self):
#         return self.speaker_name
# 
# class Session(models.Model):
#     date = models.DateField()
#     description = models.TextField(
#         blank=True, help_text='Any special theme or info about the session.')
# 
#     def __str__(self):
# 
#         return '{} - {} '.format(self.date, self.description)
# 
#     def approved_talks(self):
#         return self.talks_available.filter(status__in=('A', 'C'))
# 
#     def get_absolute_url(self):
#         return reverse('talks-sessions-id', args=[self.id])


from datetime import date
from django.http import Http404
from django.test import Client, TestCase
from .models import Talk, Session
from . import views




class TalkTestCase(TestCase):

    # Model

    def test_get_absolute_url(self):
        Talk.objects.create()
        self.assertEqual(
            Talk.objects.get(id=1).get_absolute_url(), '/talks/talks/1/')


class SessionTestCase(TestCase):

    # Model

    def test_get_absolute_url(self):
        Session.objects.create(date=date(2020, 1, 1))
        self.assertEqual(
            Session.objects.get(id=1).get_absolute_url(), '/talks/sessions/1/')

    def test_id(self):
        """A saved Session object has an id."""

# Path: podium/talks/models.py
# class Talk(models.Model):
#     speaker_name = models.CharField(max_length=1000)
#     speaker_email = models.CharField(max_length=1000)
#     title = models.CharField(max_length=1000)
#     description = models.TextField()
#     sessions_available = models.ManyToManyField(
#         'Session', related_name='talks_available')
#     status = models.CharField(
#         max_length=1, choices=TALK_STATUS_CHOICES,
#         default='S')
# 
#     def get_absolute_url(self):
#         return reverse('talks-talk-id', args=[self.id])
# 
#     def __str__(self):
#         return self.speaker_name
# 
# class Session(models.Model):
#     date = models.DateField()
#     description = models.TextField(
#         blank=True, help_text='Any special theme or info about the session.')
# 
#     def __str__(self):
# 
#         return '{} - {} '.format(self.date, self.description)
# 
#     def approved_talks(self):
#         return self.talks_available.filter(status__in=('A', 'C'))
# 
#     def get_absolute_url(self):
#         return reverse('talks-sessions-id', args=[self.id])


# Path: podium/talks/tests.py
from datetime import date
from django.http import Http404
from django.test import Client, TestCase
from .models import Talk, Session
from . import views





class TalkTestCase(TestCase):

    # Model

    def test_get_absolute_url(self):
        Talk.objects.create()
        self.assertEqual(
            Talk.objects.get(id=1).get_absolute_url(), '/talks/talks/1/')


class SessionTestCase(TestCase):

    # Model

    def test_get_absolute_url(self):
        Session.objects.create(date=date(2020, 1, 1))
        self.assertEqual(
            Session.objects.get(id=1).get_absolute_url(), '/talks/sessions/1/')

    def test_id(self):
        """A saved Session object has an id."""

        Session(date=date(2020, 1, 1)).save()