'Check if the http status is what we expected.'

def _check_status(self):

    path_to_statuses = {'/favicon.ico': [http.client.NOT_FOUND], '/does-not-exist': [http.client.NOT_FOUND], '/does-not-exist-2': [http.client.NOT_FOUND], '/status/404': [http.client.NOT_FOUND], '/custom/redirect-later': [http.client.FOUND], '/custom/redirect-self': [http.client.FOUND], '/redirect-to': [http.client.FOUND], '/cookies/set': [http.client.FOUND], '/custom/500-inline': [http.client.INTERNAL_SERVER_ERROR]}
    for i in range(15):
        path_to_statuses['/redirect/{}'.format(i)] = [http.client.FOUND]
        path_to_statuses['/relative-redirect/{}'.format(i)] = [http.client.FOUND]
        path_to_statuses['/absolute-redirect/{}'.format(i)] = [http.client.FOUND]
    for suffix in ['', '1', '2', '3', '4', '5', '6']:
        key = '/basic-auth/user{}/password{}'.format(suffix, suffix)
        path_to_statuses[key] = [http.client.UNAUTHORIZED, http.client.OK]
    default_statuses = [http.client.OK, http.client.NOT_MODIFIED]
    sanitized = QUrl(('http://localhost' + self.path)).path()
    expected_statuses = path_to_statuses.get(sanitized, default_statuses)
    if (self.status not in expected_statuses):
        raise AssertionError('{}    loaded    with    status    {}    but    expected    {}'.format(sanitized, self.status, '    /    '.join((repr(e) for e in expected_statuses))))
