1
Fork 0

Added tests for index projects

This commit is contained in:
Jake Howard 2016-03-19 22:05:20 +00:00
parent 6f6bb69384
commit e4c438450b

View file

@ -1,5 +1,7 @@
from django.test import TestCase from django.test import TestCase
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.conf import settings
import os.path, json
class AboutTestCase(TestCase): class AboutTestCase(TestCase):
@ -42,6 +44,14 @@ class CorePagesTestCase(TestCase):
response = self.client.get(reverse('pages:index')) response = self.client.get(reverse('pages:index'))
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
def test_index_projects(self):
projects = json.load(open(os.path.join(settings.BASE_DIR, 'data/projects.json')))
response = self.client.get(reverse('pages:index'))
for key, project in projects.items():
self.assertContains(response, project['title'])
if 'image' in project:
self.assertContains(response, project['image'])
class ProjectsTestCase(TestCase): class ProjectsTestCase(TestCase):
def test_all_accessable(self): def test_all_accessable(self):