def METHOD_NAME(self, userid):
    """
    Login as specified user, does not depend on auth backend (hopefully)
    This is based on Client.login() with a small hack that does not
    require the call to authenticate()
    """
    if not 'django.contrib.sessions' in settings.INSTALLED_APPS:
        raise AssertionError("Unable to login without django.contrib.sessions in INSTALLED_APPS")
    try:
        user = User.objects.get(username=userid)
    except User.DoesNotExist:
        user = User(username=userid, password='')
        user.save()
    user.backend = "%s.%s" % ("django.contrib.auth.backends",
                              "ModelBackend")
    engine = import_module(settings.SESSION_ENGINE)
    # Create a fake request to store login details.
    request = HttpRequest()
    #if self.session:
    #    request.session = self.session
    #else:
    request.session = engine.SessionStore()
    login(request, user)
    # Set the cookie to represent the session.
    session_cookie = settings.SESSION_COOKIE_NAME
    self.cookies[session_cookie] = request.session.session_key
    cookie_data = {
        'max-age': None,
        'path': '/',
        'domain': settings.SESSION_COOKIE_DOMAIN,
        'secure': settings.SESSION_COOKIE_SECURE or None,
        'expires': None,
    }
    self.cookies[session_cookie].update(cookie_data)
    # Save the session values.
    request.session.save()