annotate bns_website/videos/tests/view_tests.py @ 101:b6b072795990

Update to Django 1.3.7.
author Brian Neal <bgneal@gmail.com>
date Sat, 09 Mar 2013 16:40:32 -0600
parents a0d3bc630ebd
children
rev   line source
bgneal@60 1 """
bgneal@60 2 View tests for the videos application.
bgneal@60 3
bgneal@60 4 """
bgneal@60 5 from django.test import TestCase
bgneal@60 6 from django.core.urlresolvers import reverse
bgneal@60 7
bgneal@60 8
bgneal@60 9 class NoVideosTest(TestCase):
bgneal@60 10
bgneal@60 11 def test_index(self):
bgneal@60 12 """
bgneal@60 13 Test that the page displays without any videos in the database.
bgneal@60 14
bgneal@60 15 """
bgneal@60 16 response = self.client.get(reverse('videos'))
bgneal@60 17 self.assertEqual(response.status_code, 200)
bgneal@60 18 self.assertEqual(len(response.context['videos']), 0)
bgneal@60 19 self.assertTemplateUsed(response, 'videos/index.html')
bgneal@60 20
bgneal@60 21
bgneal@60 22 class SomeVideosTest(TestCase):
bgneal@60 23 fixtures = ['playlist.json']
bgneal@60 24
bgneal@60 25 def test_index(self):
bgneal@60 26 """
bgneal@60 27 Test that the page displays with videos in the database.
bgneal@60 28
bgneal@60 29 """
bgneal@60 30 response = self.client.get(reverse('videos'))
bgneal@60 31 self.assertEqual(response.status_code, 200)
bgneal@60 32 self.assertEqual(len(response.context['videos']), 50)
bgneal@60 33 self.assertTemplateUsed(response, 'videos/index.html')