Exemple #1
0
 def test_validate_digest_parameters_legacy(self):
     params = dict(scheme="Digest",
                   realm="testrealm",
                   username="******",
                   nonce="abcdef",
                   response="123456")
     # Missing "uri"
     self.failIf(validate_digest_parameters(params))
     params["uri"] = "/my/page"
     self.failUnless(validate_digest_parameters(params))
 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(validate_digest_parameters(params))
     # Malformed "nc"
     params["nc"] = "0000000001"
     self.failIf(validate_digest_parameters(params))
     params["nc"] = "XYZ"
     self.failIf(validate_digest_parameters(params))
     params["nc"] = "001"
     self.failUnless(validate_digest_parameters(params))
     # Unknown qop
     params["qop"] = "super-duper"
     self.failIf(validate_digest_parameters(params))
     params["qop"] = "auth-int"
     self.failUnless(validate_digest_parameters(params))
     params["qop"] = "auth"
     # Unknown algorithm
     params["algorithm"] = "sha1"
     self.failIf(validate_digest_parameters(params))
     params["algorithm"] = "md5"
     self.failUnless(validate_digest_parameters(params))
Exemple #3
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(validate_digest_parameters(params))
     # Malformed "nc"
     params["nc"] = "0000000001"
     self.failIf(validate_digest_parameters(params))
     params["nc"] = "XYZ"
     self.failIf(validate_digest_parameters(params))
     params["nc"] = "001"
     self.failUnless(validate_digest_parameters(params))
     # Unknown qop
     params["qop"] = "super-duper"
     self.failIf(validate_digest_parameters(params))
     params["qop"] = "auth-int"
     self.failUnless(validate_digest_parameters(params))
     params["qop"] = "auth"
     # Unknown algorithm
     params["algorithm"] = "sha1"
     self.failIf(validate_digest_parameters(params))
     params["algorithm"] = "md5"
     self.failUnless(validate_digest_parameters(params))
 def test_validate_digest_parameters_legacy(self):
     params = dict(scheme="Digest", realm="testrealm", username="******", nonce="abcdef", response="123456")
     # Missing "uri"
     self.failIf(validate_digest_parameters(params))
     params["uri"] = "/my/page"
     self.failUnless(validate_digest_parameters(params))