def test_change_password(self): """Empty docstring""" pa = PasswordAuthentication() pa.username = u'nathan' pa.user = self.__user pa.password("theSuperHardPassword") self.__database.add(pa) pa.password("theNewPassword") self.assertTrue(pa.testPassword("theNewPassword")) self.assertFalse(pa.testPassword("theSuperHardPassword"))
def test_store_passwor_authentication(self): """Empty docstring""" pa = PasswordAuthentication() pa.username = u'nathan' pa.user = self.__user pa.password("theSuperHardPassword") self.__database.add(pa) pa = self.__database.find(PasswordAuthentication, PasswordAuthentication.username == u'nathan').one() self.assertTrue(pa.testPassword("theSuperHardPassword")) self.assertFalse(pa.testPassword("theSuperWrongPassword"))
def test_reset_with_no_request(self): """Empty docstring""" pa = PasswordAuthentication() pa.username = u'nathan' pa.user = self.__user pa.password("theSuperHardPassword") self.__database.add(pa) self.assertRaises(Exception, pa.reset, None, "newPass") self.assertFalse(pa.testPassword("newPass"))
def test_reset(self): """Empty docstring""" pa = PasswordAuthentication() pa.username = u'nathan' pa.user = self.__user pa.password("theSuperHardPassword") self.__database.add(pa) hsh = pa.requestReset() pa.reset(hsh, "newPassword") self.assertTrue(pa.testPassword("newPassword"))
def test_store_password(self): """Empty docstring""" pa = PasswordAuthentication() pa.username = u'nathansamson' pa.password("mePassword") self.__database.add(pa) self.__database.flush() pa = self.__database.find(PasswordAuthentication, PasswordAuthentication.username\ == u"nathansamson").one() self.assertTrue(pa.testPassword("mePassword"))
def test_save_password(self): """Empty docstring""" pa = PasswordAuthentication() pa.user = self.__user pa.username = u'nathansamson' pa.password("mePassword") self.__database.add(pa) pa = self.__database.find(PasswordAuthentication, PasswordAuthentication.username\ == u"nathansamson").one() hsh = pa.requestReset() self.__database.flush() pa = self.__database.find(PasswordAuthentication, PasswordAuthentication.username\ == u"nathansamson").one() pa.reset(hsh, "newPassword") self.__database.flush() pa = self.__database.find(PasswordAuthentication, PasswordAuthentication.username\ == u"nathansamson").one() self.assertTrue(pa.testPassword("newPassword"))