1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Introduced HttpStatusMixin to provide more detail on HTTP response status test failures

This commit is contained in:
Jeremy Stretch
2017-03-20 13:46:47 -04:00
parent 1988c02b7f
commit 42fd14f5c0
6 changed files with 183 additions and 168 deletions

10
netbox/utilities/tests.py Normal file
View File

@ -0,0 +1,10 @@
class HttpStatusMixin(object):
"""
Custom mixin to provide more detail in the event of an unexpected HTTP response.
"""
def assertHttpStatus(self, response, expected_status):
err_message = "Expected HTTP status {}; received {}: {}"
self.assertEqual(response.status_code, expected_status, err_message.format(
expected_status, response.status_code, response.data
))