##// END OF EJS Templates
Added signatures to the GET response. Added a view to get a full post response for one post. Don't show post key as it is present in the XML post view. Changed key display format
Added signatures to the GET response. Added a view to get a full post response for one post. Don't show post key as it is present in the XML post view. Changed key display format

File last commit:

r821:572aaa88 default
r837:fbeaaa16 decentral
Show More
test_views.py
38 lines | 1.1 KiB | text/x-python | PythonLexer
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
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
logger.debug('Testing view %s' % view_name)
try:
response = client.get(reverse(view_name))
self.assertEqual(HTTP_CODE_OK, response.status_code,
'%s view not opened' % view_name)
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