def test_ignore_case(self):
    self.reset.append( conf.AUTH.IGNORE_USERNAME_CASE.set_for_testing(True) )

    response = self.c.get('/accounts/login/')
    assert_equal(200, response.status_code, "Expected ok status.")
    assert_false(response.context['first_login_ever'])

    response = self.c.post('/accounts/login/', {}, **{"REMOTE_USER": self.test_username})
    assert_equal(200, response.status_code, "Expected ok status.")
    assert_equal(1, len(User.objects.all()))
    assert_equal(self.test_username, User.objects.all()[0].username)

    response = self.c.post('/accounts/login/', {}, **{"REMOTE_USER": self.test_username.upper()})
    assert_equal(200, response.status_code, "Expected ok status.")
    assert_equal(1, len(User.objects.all()))
    assert_equal(self.test_username, User.objects.all()[0].username)

    response = self.c.post('/accounts/login/', {}, **{"REMOTE_USER": "%s_%s" % (self.test_username.upper(), '2')})
    assert_equal(200, response.status_code, "Expected ok status.")
    assert_equal(2, len(User.objects.all().order_by('username')))
    assert_equal("%s_%s" % (self.test_username, '2'), User.objects.all().order_by('username')[1].username)

    response = self.c.post('/accounts/login/', {}, **{"REMOTE_USER": "%s_%s" % (self.test_username, '2')})
    assert_equal(200, response.status_code, "Expected ok status.")
    assert_equal(2, len(User.objects.all()))
    assert_equal("%s_%s" % (self.test_username, '2'), User.objects.all().order_by('username')[1].username)
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/auth/views_test.py/TestRemoteUserLogin.test_ignore_case/original