def test_password_encryption(self): """ Tests the ability to encrypt passwords """ account = Account.objects.get(username=self.username) #encrypted password generated self.assertIsNotNone(account.password) self.assertEqual(processPassword(self.password), account.password) #encrypetd password is not same as original self.assertNotEqual(self.password, account.password)
def setUp(self): self.username = "******" self.email = "*****@*****.**" self.phone = "21212345678" self.password = "******" Account.objects.create( username=self.username, email=self.email, phone=self.phone, password=processPassword(self.password) )
def clean_password(self): return processPassword(self.cleaned_data['password'])