##// END OF EJS Templates
Get mimetype for file in the form and use it for both images and attachments
Get mimetype for file in the form and use it for both images and attachments

File last commit:

r1175:3d7a615a decentral
r1371:ca879451 default
Show More
test_views.py
47 lines | 1.3 KiB | text/x-python | PythonLexer
neko259
Split tests module into separate modules
r821 import logging
from django.core.urlresolvers import reverse, NoReverseMatch
from django.test import TestCase, Client
from boards import urls
logger = logging.getLogger(__name__)
HTTP_CODE_OK = 200
neko259
404 page now returns the 404 status for real. Fixed some tests related to...
r890 EXCLUDED_VIEWS = {
'banned',
neko259
Refactored websockets notifications and updating threads when updating posts
r1088 'get_thread_diff',
neko259
404 page now returns the 404 status for real. Fixed some tests related to...
r890 }
neko259
Split tests module into separate modules
r821
class ViewTest(TestCase):
def test_all_views(self):
"""
Try opening all views defined in ulrs.py that don't need additional
parameters
"""
client = Client()
for url in urls.urlpatterns:
try:
view_name = url.name
neko259
404 page now returns the 404 status for real. Fixed some tests related to...
r890 if view_name in EXCLUDED_VIEWS:
logger.debug('View {} is excluded.'.format(view_name))
continue
neko259
Split tests module into separate modules
r821 logger.debug('Testing view %s' % view_name)
try:
response = client.get(reverse(view_name))
self.assertEqual(HTTP_CODE_OK, response.status_code,
neko259
404 page now returns the 404 status for real. Fixed some tests related to...
r890 'View not opened: {}'.format(view_name))
neko259
Split tests module into separate modules
r821 except NoReverseMatch:
# This view just needs additional arguments
pass
except Exception as e:
self.fail('Got exception %s at %s view' % (e, view_name))
except AttributeError:
# This is normal, some views do not have names
pass