def test_update_password(self): builder = Builder.get(Builder.create('some builder', 'some password')) self.assertEqual(builder.password, Builder._hashed_password('some password')) builder.update_password('other password') self.assertEqual(builder.password, Builder._hashed_password('other password')) # Make sure it's saved builder = Builder.get(builder.key()) self.assertEqual(builder.password, Builder._hashed_password('other password'))
def test_create(self): builder_key = Builder.create('some builder', 'some password') self.assertTrue(builder_key) builder = Builder.get(builder_key) self.assertEqual(builder.key().name(), 'some builder') self.assertEqual(builder.name, 'some builder') self.assertEqual(builder.password, Builder._hashed_password('some password'))
def test_hashed_password(self): self.assertNotEqual(Builder._hashed_password('some password'), 'some password') self.assertFalse('some password' in Builder._hashed_password('some password')) self.assertEqual(len(Builder._hashed_password('some password')), 64)