symposion_app/symposion/schedule/tests/test_views_session.py
Hiroshi Miura a41fb8bd35 schedule: add session and session role
port from pycon development

Luke Hatcher committed 6889d05
2013-01-31
add session volunteer staff

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2015-06-18 23:37:11 +09:00

58 lines
1.9 KiB
Python

from datetime import date
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from symposion.conference.models import Section, current_conference, Conference
from symposion.schedule.models import Day, Schedule, Session
class TestScheduleViews(TestCase):
username = "user@example.com"
first_name = "Sam"
last_name = "McGillicuddy"
def setUp(self):
self.user = User.objects.create_user(self.username,
password="pass",
email=self.username)
self.user.first_name = self.first_name
self.user.last_name = self.last_name
self.user.save()
def test_session_list(self):
# Really minimal test for session list
rsp = self.client.get(reverse("schedule_session_list"))
self.assertEqual(200, rsp.status_code)
def test_session_staff_email(self):
# login and staff required
self.user.is_staff = True
self.user.save()
assert self.client.login(username=self.username, password="pass")
url = reverse("schedule_session_staff_email")
rsp = self.client.get(url)
self.assertEqual(200, rsp.status_code)
def test_session_detail(self):
# really minimal test
Conference.objects.get_or_create(id=settings.CONFERENCE_ID)
section = Section.objects.create(
conference=current_conference(),
)
schedule = Schedule.objects.create(
section=section,
)
day = Day.objects.create(
schedule=schedule,
date=date.today(),
)
session = Session.objects.create(
day=day,
)
url = reverse("schedule_session_detail", args=(session.pk,))
rsp = self.client.get(url)
self.assertEqual(200, rsp.status_code)