def assert_code(response, status_code, msg_prefix=''):

    if msg_prefix:
        msg_prefix = '%s: ' % msg_prefix

    assert response.status_code == status_code, \
        'Response code was %d (expected %d)' % \
            (response.status_code, status_code)
Asserts the response was returned with the given status code
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/django-nose-1.3/django_nose/tools.py/assert_code