Added tests for index projects
This commit is contained in:
parent
6f6bb69384
commit
e4c438450b
1 changed files with 10 additions and 0 deletions
|
@ -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):
|
||||||
|
|
Reference in a new issue