Exemplo n.º 1
0
 def test_wrongPassword(self):
     """
     Calling C{checkPassword} on a L{UsernameHashedPassword} will return
     L{False} when the password given is NOT the password on the object.
     """
     creds = UsernameHashedPassword(b"user", b"pass")
     self.assertFalse(creds.checkPassword(b"someotherpass"))
Exemplo n.º 2
0
 def test_correctPassword(self):
     """
     Calling C{checkPassword} on a L{UsernameHashedPassword} will return
     L{True} when the password given is the password on the object.
     """
     creds = UsernameHashedPassword(b"user", b"pass")
     self.assertTrue(creds.checkPassword(b"pass"))
Exemplo n.º 3
0
 def test_wrongPassword(self):
     """
     Calling C{checkPassword} on a L{UsernameHashedPassword} will return
     L{False} when the password given is NOT the password on the object.
     """
     creds = UsernameHashedPassword(b"user", b"pass")
     self.assertFalse(creds.checkPassword(b"someotherpass"))
Exemplo n.º 4
0
 def test_correctPassword(self):
     """
     Calling C{checkPassword} on a L{UsernameHashedPassword} will return
     L{True} when the password given is the password on the object.
     """
     creds = UsernameHashedPassword(b"user", b"pass")
     self.assertTrue(creds.checkPassword(b"pass"))
Exemplo n.º 5
0
 def test_initialisation(self):
     """
     The initialisation of L{UsernameHashedPassword} will set C{username}
     and C{hashed} on it.
     """
     creds = UsernameHashedPassword(b"foo", b"bar")
     self.assertEqual(creds.username, b"foo")
     self.assertEqual(creds.hashed, b"bar")
Exemplo n.º 6
0
 def test_usernameHashedPasswordDeprecated(self):
     """
     Authenticating with L{twisted.cred.credentials.IUsernameHashedPassword}
     credentials emits a deprecation warning.
     """
     account = self.realm.addAccount(self.localpart, self.domain,
                                     self.password)
     username = u'%s@%s' % (self.localpart, self.domain)
     aid = self.successResultOf(
         self._requestAvatarId(
             UsernameHashedPassword(username, self.password)))
     self.assertEquals(aid, account.storeID)
     ws = self.flushWarnings()
     self.assertEquals(ws[0]['category'], DeprecationWarning)