def test_get_200_json(self): '''Simple test of a good URI.''' response = views.all_data(MockRequest(http_accept="application/json")) self.assertEqual(response.status_code,200) try: import json json.dumps(response.content) except Exception, e: raise AssertionError(e)
def test_allowed_method(self): '''Test of allowed methods.''' response = views.all_data(MockRequest(method='POST')) self.assertEqual(response.status_code,405) response = views.all_data(MockRequest(method='PUT')) self.assertEqual(response.status_code,405) response = views.all_data(MockRequest(method='OPTIONS')) self.assertEqual(response.status_code,405) response = views.all_data(MockRequest(method='HEAD')) self.assertEqual(response.status_code,405) response = views.all_data(MockRequest(method='DELETE')) self.assertEqual(response.status_code,405) response = views.all_data(MockRequest(method='PATCH')) self.assertEqual(response.status_code,405) response = views.all_data(MockRequest(method='TRACE')) self.assertEqual(response.status_code,405) response = views.all_data(MockRequest(method='')) self.assertEqual(response.status_code,405)
def test_get_200(self): '''Simple test of a good URI.''' response = views.all_data(MockRequest()) self.assertEqual(response.status_code,200)