def test_validate_digest_parameters_legacy(self):
     params = dict(scheme="Digest", realm="testrealm", username="******",
                   nonce="abcdef", response="123456")
     # Missing "uri"
     self.failIf(utils.validate_digest_parameters(params))
     params["uri"] = "/my/page"
     self.failUnless(utils.validate_digest_parameters(params))
     # Wrong realm
     self.failIf(utils.validate_digest_parameters(params, realm="otherrealm"))
     self.failUnless(utils.validate_digest_parameters(params, realm="testrealm"))
예제 #2
0
 def test_validate_digest_parameters_qop(self):
     params = dict(scheme="Digest",
                   realm="testrealm",
                   username="******",
                   nonce="abcdef",
                   response="123456",
                   qop="auth",
                   uri="/my/page",
                   cnonce="98765")
     # Missing "nc"
     self.failIf(utils.validate_digest_parameters(params))
     params["nc"] = "0001"
     self.failUnless(utils.validate_digest_parameters(params))
     # Wrong realm
     self.failIf(
         utils.validate_digest_parameters(params, realm="otherrealm"))
     self.failUnless(
         utils.validate_digest_parameters(params, realm="testrealm"))
     # Unknown qop
     params["qop"] = "super-duper"
     self.failIf(utils.validate_digest_parameters(params))
     params["qop"] = "auth-int"
     self.failUnless(utils.validate_digest_parameters(params))
     params["qop"] = "auth"
     # Unknown algorithm
     params["algorithm"] = "sha1"
     self.failIf(utils.validate_digest_parameters(params))
     params["algorithm"] = "md5"
     self.failUnless(utils.validate_digest_parameters(params))
예제 #3
0
 def test_validate_digest_parameters_legacy(self):
     params = dict(scheme="Digest",
                   realm="testrealm",
                   username="******",
                   nonce="abcdef",
                   response="123456")
     # Missing "uri"
     self.failIf(utils.validate_digest_parameters(params))
     params["uri"] = "/my/page"
     self.failUnless(utils.validate_digest_parameters(params))
     # Wrong realm
     self.failIf(
         utils.validate_digest_parameters(params, realm="otherrealm"))
     self.failUnless(
         utils.validate_digest_parameters(params, realm="testrealm"))
 def test_validate_digest_parameters_qop(self):
     params = dict(scheme="Digest", realm="testrealm", username="******",
                   nonce="abcdef", response="123456", qop="auth",
                   uri="/my/page", cnonce="98765")
     # Missing "nc"
     self.failIf(utils.validate_digest_parameters(params))
     params["nc"] = "0001"
     self.failUnless(utils.validate_digest_parameters(params))
     # Wrong realm
     self.failIf(utils.validate_digest_parameters(params, realm="otherrealm"))
     self.failUnless(utils.validate_digest_parameters(params, realm="testrealm"))
     # Unknown qop
     params["qop"] = "super-duper"
     self.failIf(utils.validate_digest_parameters(params))
     params["qop"] = "auth-int"
     self.failUnless(utils.validate_digest_parameters(params))
     params["qop"] = "auth"
     # Unknown algorithm
     params["algorithm"] = "sha1"
     self.failIf(utils.validate_digest_parameters(params))
     params["algorithm"] = "md5"
     self.failUnless(utils.validate_digest_parameters(params))