github.com/chasestarr/deis@v1.13.5-0.20170519182049-1d9e59fbdbfc/controller/api/tests/test_healthcheck.py (about) 1 from __future__ import unicode_literals 2 3 from django.test import TestCase 4 5 6 class HealthCheckTest(TestCase): 7 8 def setUp(self): 9 self.url = '/healthz' 10 11 def test_healthcheck(self): 12 # GET and HEAD (no auth required) 13 resp = self.client.get(self.url) 14 self.assertEqual(resp.status_code, 200) 15 self.assertEqual(resp.content, "OK") 16 17 resp = self.client.head(self.url) 18 self.assertEqual(resp.status_code, 200) 19 20 def test_healthcheck_invalid(self): 21 for method in ('put', 'post', 'patch', 'delete'): 22 resp = getattr(self.client, method)(self.url) 23 # method not allowed 24 self.assertEqual(resp.status_code, 405)