From e4c438450bdc77e226ba6236dafce6d8615a6ed0 Mon Sep 17 00:00:00 2001 From: RealOrangeOne Date: Sat, 19 Mar 2016 22:05:20 +0000 Subject: [PATCH] Added tests for index projects --- project/pages/tests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/project/pages/tests.py b/project/pages/tests.py index 94dccfe..36ef458 100644 --- a/project/pages/tests.py +++ b/project/pages/tests.py @@ -1,5 +1,7 @@ from django.test import TestCase from django.core.urlresolvers import reverse +from django.conf import settings +import os.path, json class AboutTestCase(TestCase): @@ -42,6 +44,14 @@ class CorePagesTestCase(TestCase): response = self.client.get(reverse('pages:index')) 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): def test_all_accessable(self):