Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Commit

Permalink
Added tests for draft events appearing in event containers
Browse files Browse the repository at this point in the history
  • Loading branch information
daisylb committed Apr 5, 2013
1 parent 78627ae commit 04aff02
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mezzanine_events/tests.py
Expand Up @@ -3,6 +3,7 @@
from django.test import TestCase
from django.test.client import Client
from .models import EventContainer, Event
from mezzanine.core.models import CONTENT_STATUS_DRAFT, CONTENT_STATUS_PUBLISHED
from datetime import date, time


Expand All @@ -15,15 +16,30 @@ def setUp(self):
self.ec.save()
self.event = Event.objects.create(
slug='cont/blah',
title='THIS IS AN EVENT THAT IS PUBLISHED',
parent=self.ec,
date=date.today(),
start_time=time(9),
end_time=time(17,30),
speakers='Fred\nJoe',
location='1 Susan St\nHindmarsh\nSouth Australia',
rsvp='By 31 December to aaa@bbb.com',
status=CONTENT_STATUS_PUBLISHED,
)
self.event.save()
self.draft_event = Event.objects.create(
slug='cont/draft',
title='THIS IS AN EVENT THAT IS A DRAFT',
parent=self.ec,
date=date.today(),
start_time=time(9),
end_time=time(17,30),
speakers='Fred\nJoe',
location='1 Susan St\nHindmarsh\nSouth Australia',
rsvp='By 31 December to aaa@bbb.com',
status=CONTENT_STATUS_DRAFT,
)
self.draft_event.save()
self.unicode_event = Event.objects.create(
slug='cont/\u30b5\u30f3\u30b7\u30e3\u30a4\u30f360',
parent=self.ec,
Expand All @@ -32,6 +48,7 @@ def setUp(self):
start_time=time(18),
end_time=time(23,59),
location='\u30b5\u30f3\u30b7\u30e3\u30a4\u30f360',
status=CONTENT_STATUS_PUBLISHED,
)
self.unicode_event.save()
self.events = (self.event, self.unicode_event)
Expand Down Expand Up @@ -67,3 +84,9 @@ def test_icalendars(self):
r = c.get('/cont/calendar.ics')
self.assertEqual(r.status_code, 200)
self.assertEqual(r['Content-Type'], 'text/calendar')

def test_container(self):
c = Client()
r = c.get('/cont/')
self.assertContains(r, self.event.title)
self.assertNotContains(r, self.draft_event.title)

0 comments on commit 04aff02

Please sign in to comment.