Commit b0383033 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

django-lib: Additional BaseAPITest helper assertion

Introduce assertMethodNotAllowed method in BaseAPITest class. The method
asserts that provided response is a valid ``Method not allowed`` API response.
parent b2536d41
......@@ -187,6 +187,14 @@ class BaseAPITest(TestCase):
def assertItemNotFound(self, response):
self.assertFault(response, 404, 'itemNotFound')
def assertMethodNotAllowed(self, response):
self.assertFault(response, 400, 'badRequest')
error = json.loads(response.content)
except ValueError:
self.assertEqual(error['badRequest']['message'], 'Method not allowed')
# Imitate unittest assertions new in Python 2.7
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment