1
Fork 0

Add tests for project details

This commit is contained in:
Jake Howard 2016-03-20 17:49:31 +00:00
parent 827c6c483e
commit e2e4c517ec

View file

@ -62,6 +62,20 @@ class ProjectsTestCase(TestCase):
response = self.client.get(reverse('projects:project', args=['test'])) response = self.client.get(reverse('projects:project', args=['test']))
self.assertEqual(response.status_code, 200) 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): class RoboticsTestCase(TestCase):
def test_2015_index_accessable(self): def test_2015_index_accessable(self):