def test_auth_with_invalid_content_md5(self): policy = DigestAuthenticationPolicy("test", get_password=lambda u: "testing") request = make_request(REQUEST_METHOD="GET", PATH_INFO="/authint", HTTP_CONTENT_MD5="1B2M2Y8AsgTpgAmY7PhCfg==") params = get_challenge(policy, request) params = build_response(params, request, "tester", "testing", qop="auth-int") request["HTTP_CONTENT_MD5"] = "8baNZjN6gc+g0gdhccuiqA==" self.assertEquals(policy._authenticate(request, params), False)
def test_auth_good_legacy_mode(self): policy = DigestAuthenticationPolicy("test", get_password=lambda u: "testing") request = make_request(REQUEST_METHOD="GET", PATH_INFO="/legacy") params = get_challenge(policy, request) params = build_response(params, request, "tester", "testing", qop=None) self.failIf("qop" in params) self.assertNotEquals(policy._authenticate(request, params), None)
def test_auth_good_authint_mode(self): policy = DigestAuthenticationPolicy("test", get_password=lambda u: "testing") request = make_request(REQUEST_METHOD="GET", PATH_INFO="/authint", HTTP_CONTENT_MD5="1B2M2Y8AsgTpgAmY7PhCfg==") params = get_challenge(policy, request) params = build_response(params, request, "tester", "testing", qop="auth-int") self.assertNotEquals(policy._authenticate(request, params), None)