def setUp(self): e = Entry(title='Twitter', username='******', url='twitter.com', password='******', comment='no comment') c = Category(title='Internet', parent=None) self.entry = e self.category = c c.save() e.category = c e.save()
def test_save_entry_with_encrypted_key(self): c = Category(title='Internet') c.save() for i, password in enumerate(self.texts): password_after_encryption = self.engine.encrypt(password) title = 'My Twitter Account: ' + str(i) e = Entry(title=title, username='******', url='twitter.com', password=password_after_encryption, comment='no comment') e.category = c e.save() # Fetches the saved entry f = Entry.objects.filter(title=title)[0] password_decrypted = self.engine.decrypt(f.password) self.assertEquals(password_after_encryption, f.password) self.assertEquals(password_decrypted, password) f.delete()