bgneal@60: """ bgneal@60: View tests for the videos application. bgneal@60: bgneal@60: """ bgneal@60: from django.test import TestCase bgneal@60: from django.core.urlresolvers import reverse bgneal@60: bgneal@60: bgneal@60: class NoVideosTest(TestCase): bgneal@60: bgneal@60: def test_index(self): bgneal@60: """ bgneal@60: Test that the page displays without any videos in the database. bgneal@60: bgneal@60: """ bgneal@60: response = self.client.get(reverse('videos')) bgneal@60: self.assertEqual(response.status_code, 200) bgneal@60: self.assertEqual(len(response.context['videos']), 0) bgneal@60: self.assertTemplateUsed(response, 'videos/index.html') bgneal@60: bgneal@60: bgneal@60: class SomeVideosTest(TestCase): bgneal@60: fixtures = ['playlist.json'] bgneal@60: bgneal@60: def test_index(self): bgneal@60: """ bgneal@60: Test that the page displays with videos in the database. bgneal@60: bgneal@60: """ bgneal@60: response = self.client.get(reverse('videos')) bgneal@60: self.assertEqual(response.status_code, 200) bgneal@60: self.assertEqual(len(response.context['videos']), 50) bgneal@60: self.assertTemplateUsed(response, 'videos/index.html')