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)
Assert the response was returned with the given status code.
dataset/ETHPy150Open django-nose/django-nose/django_nose/tools.py/assert_code