Skip to content

Commit

Permalink
pyconsk#58 tests - sponsors list, meetup
Browse files Browse the repository at this point in the history
  • Loading branch information
jbezrucka committed Nov 21, 2016
1 parent ef3613b commit 585a1b0
Showing 1 changed file with 42 additions and 7 deletions.
49 changes: 42 additions & 7 deletions konfera/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.test import TestCase
from django.utils.translation import ugettext_lazy as _

from konfera.models import Event, Location, Organizer, Talk, TicketType, Ticket
from konfera.models import Event, Location, Organizer, Sponsor, Talk, TicketType, Ticket
from konfera.models.order import Order

if VERSION[1] in (8, 9):
Expand All @@ -14,7 +14,7 @@
class TestEventRedirect(TestCase):
def setUp(self):
self.location = Location.objects.create(
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', state='Slovakia', capacity=400,
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', country='SK', capacity=400,
)
self.one = Event.objects.create(
title='One', slug='one', description='First one', event_type=Event.CONFERENCE, status=Event.PUBLISHED,
Expand All @@ -41,7 +41,7 @@ def test_redirects(self):
class TestEventList(TestCase):
def setUp(self):
self.location = Location.objects.create(
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', state='Slovakia', capacity=400,
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', country='Slovakia', capacity=400,
)
self.one = Event.objects.create(
title='One', slug='one', description='First one', event_type='conference', status='published',
Expand Down Expand Up @@ -124,6 +124,24 @@ def test_cfp_successful_form_submit(self):
self.assertRedirects(response, reverse('event_details', kwargs={'slug': 'one'}))


class TestMeetup(TestCase):
def setUp(self):
self.location = Location.objects.create(
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', country='Slovakia', capacity=400,
)
Event.objects.create(
title='Meetup', slug='meetup', description='Fabulous meetup', event_type='meetup', status='published',
location=self.location, date_from='2016-01-01 17:00:00+01:00', date_to='2016-01-01 19:00:00+01:00',
)

def test_get_meetup(self):
response = self.client.get('/meetup/')
# Check that the response is 200 OK.
self.assertEqual(response.status_code, 200)
# Check if about us text is present
self.assertIn('Fabulous meetup', str(response.content))


class TestEventOrganizer(TestCase):
def setUp(self):
self.location = Location.objects.create(title='FIIT', street='Ilkovicova', city='Bratislava', capacity=400)
Expand Down Expand Up @@ -154,7 +172,7 @@ def test_event_no_organizer(self):
class TestOrderDetail(TestCase):
def setUp(self):
self.location = Location.objects.create(
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', state='Slovakia', capacity=400,
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', country='Slovakia', capacity=400,
)
self.one = Event.objects.create(
title='One', slug='one', description='First one', event_type='conference', status='published',
Expand Down Expand Up @@ -213,7 +231,7 @@ class TestIndexRedirect(TestCase):

def setUp(self):
self.location = Location.objects.create(
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', state='Slovakia', capacity=400,
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', country='Slovakia', capacity=400,
)

def test_no_conference(self):
Expand Down Expand Up @@ -259,10 +277,10 @@ class TestEventVenue(TestCase):
def setUp(self):
self.html_code = '<strong>test</strong>'
self.location = Location.objects.create(
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', state='Slovakia', capacity=400,
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', country='SK', capacity=400,
)
self.location_with_venue = Location.objects.create(
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', state='Slovakia', capacity=400,
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', country='SK', capacity=400,
get_here=self.html_code,
)

Expand Down Expand Up @@ -291,3 +309,20 @@ def test_venue_get_here_filled_not_escaped(self):
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'konfera/event_venue.html')
self.assertTrue(self.html_code in response.content.decode('utf-8'))


class TestSponsorsListView(TestCase):
def setUp(self):
location = Location.objects.create(
title='FIIT', street='Ilkovicova', city='Bratislava', postcode='841 04', country='SK', capacity=400,)
Event.objects.create(
title='Small Event', slug='small_event', description='Small event', event_type='conference',
status='published', date_from='2015-01-01 01:01:01+01:00', date_to='2015-01-03 01:01:01+01:00',
location=location,)
Sponsor.objects.create(title='Sponsor 1', type=1, about_us='Platinum Sponsor')
Sponsor.objects.create(title='Sponsor 2', type=2, about_us='Gold Sponsor')

def test_sponsors_list(self):
response = self.client.get('/small_event/sponsors/')
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'konfera/event_sponsors.html')

0 comments on commit 585a1b0

Please sign in to comment.