Example #1
0
 def _testmakeIdentity_1(self, msg):
     ident = self.ident
     challenge = ident.challenge()
     hashedPassword = util.respond(challenge, "password")
     pwrq = ident.verifyPassword(challenge, hashedPassword)
     pwrq.addCallback(self._testmakeIdentity_2)
     pwrq.addErrback(self._testmakeIdentity_2fail)
Example #2
0
 def _testmakeIdentity_1(self, msg):
     # complex password verification
     ident = self.ident
     challenge = ident.challenge()
     hashedPassword = util.respond(challenge, "password")
     pwrq = ident.verifyPassword(challenge, hashedPassword)
     pwrq.addCallback(self._testmakeIdentity_2)
     pwrq.addErrback(self._testmakeIdentity_2fail)
Example #3
0
    def test_respond(self):
        """
        L{respond} applies a particular hashing to a challenge and a password
        and returns the result.  It is deprecated and calling it emits a
        deprecation warning.
        """
        # Use some values and test against the known correct output.
        self.assertEqual(
            util.respond('foo', 'bar').encode('hex'),
            'ebe4a2902532198cafaa223fb5ac0f20')

        warnings = self.flushWarnings(offendingFunctions=[self.test_respond])
        self.assertEqual(
            warnings[0]['message'],
            'twisted.cred.util.respond is deprecated since Twisted 8.3.')
        self.assertEqual(warnings[0]['category'], PendingDeprecationWarning)
        self.assertEqual(len(warnings), 1)
Example #4
0
    def test_respond(self):
        """
        L{respond} applies a particular hashing to a challenge and a password
        and returns the result.  It is deprecated and calling it emits a
        deprecation warning.
        """
        # Use some values and test against the known correct output.
        self.assertEqual(
            util.respond('foo', 'bar').encode('hex'),
            'ebe4a2902532198cafaa223fb5ac0f20')

        warnings = self.flushWarnings(offendingFunctions=[self.test_respond])
        self.assertEqual(
            warnings[0]['message'],
            'twisted.cred.util.respond is deprecated since Twisted 8.3.')
        self.assertEqual(
            warnings[0]['category'],
            PendingDeprecationWarning)
        self.assertEqual(len(warnings), 1)