1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
theorangeone.net-legacy/project/pages/tests.py
2016-04-05 22:37:37 +01:00

19 lines
691 B
Python

from django.test import TestCase
from django.conf import settings
import os.path
from glob import glob
class PagesTestCase(TestCase):
def setUp(self):
directories = glob(os.path.join(settings.BASE_DIR, 'templates') + '/**/*.*')
self.urls = []
for directory in directories:
if 'email' in directory or 'blog' in directory:
continue
self.urls.append(directory.replace(os.path.join(settings.BASE_DIR, 'templates'), '').split('.')[0].replace('index', ''))
def test_pages_accessable(self):
for path in self.urls:
response = self.client.get(path)
self.assertEqual(response.status_code, 200)