I've got a project where some changes may lead to 500 status in some views.
What is the most elegant way to make unit tests that will check all the views/pages (with static routes, without vars in them, of course) for not returning 500 status?
For unit tests you can use something like:
from django import test
from django.core.urlresolvers import reverse
from page.urls import urlpatterns
class PageTest(test.TestCase):
   def test_responses(self):
       for url in urlpatterns:
           response = self.client.get(reverse(url.name))
           self.assertEqual(response.status_code, 200)
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With