From e2e4c517ecfbedf9c80205972fa0233d2e627fe8 Mon Sep 17 00:00:00 2001 From: RealOrangeOne Date: Sun, 20 Mar 2016 17:49:31 +0000 Subject: [PATCH] Add tests for project details --- project/pages/tests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/project/pages/tests.py b/project/pages/tests.py index 36ef458..29f6a23 100644 --- a/project/pages/tests.py +++ b/project/pages/tests.py @@ -62,6 +62,20 @@ class ProjectsTestCase(TestCase): response = self.client.get(reverse('projects:project', args=['test'])) self.assertEqual(response.status_code, 200) + def test_projects_accessable(self): + projects = json.load(open(os.path.join(settings.BASE_DIR, 'data/projects.json'))) + for key, project in projects.items(): + response = self.client.get(reverse('projects:project', args=[key])) + self.assertEqual(response.status_code, 200) + + def test_projects_details(self): + projects = json.load(open(os.path.join(settings.BASE_DIR, 'data/projects.json'))) + for key, project in projects.items(): + response = self.client.get(reverse('projects:project', args=[key])) + self.assertContains(response, project['title']) + if 'image' in project: + self.assertContains(response, project['image']) + class RoboticsTestCase(TestCase): def test_2015_index_accessable(self):