'This proves that when an AttributeError is raised inside of the request.user
property, that we can handle this and report the true, underlying error.'

def test_calling_user_fails_when_attribute_error_is_raised(self):

    class AuthRaisesAttributeError(object, ):
        def authenticate(self, request):
            import rest_framework
            rest_framework.MISSPELLED_NAME_THAT_DOESNT_EXIST
    self.request = Request(factory.get(u'/'), authenticators=(AuthRaisesAttributeError(),))
    SessionMiddleware().process_request(self.request)
    login(self.request, self.user)
    try:
        self.request.user
    except AttributeError as error:
        assert (str(error) in (u"'module'    object    has    no    attribute    'MISSPELLED_NAME_THAT_DOESNT_EXIST'", u"module    'rest_framework'    has    no    attribute    'MISSPELLED_NAME_THAT_DOESNT_EXIST'"))
    else:
        assert False, u'AttributeError    not    raised'
