def testBadPassword(self): user = User(identity_id=uuid.uuid4(), primary=True) user.set_password('password') user.save() form = AuthenticationForm(data={ 'username': str(user.id), 'password': '******' }) self.assertFalse(form.is_valid())
def testUUID(self): user = User(identity_id=uuid.uuid4(), primary=True) user.set_password('password') user.save() form = AuthenticationForm(data={ 'username': str(user.id), 'password': '******' }) self.assertTrue(form.is_valid()) self.assertEqual(str(user.id), form.cleaned_data['username'])
def testEmail(self): user = User(identity_id=uuid.uuid4(), primary=True) UserEmail.objects.create(user=user, email='*****@*****.**') user.set_password('password') user.save() form = AuthenticationForm(data={ 'username': '******', 'password': '******' }) self.assertTrue(form.is_valid()) self.assertEqual(str(user.id), form.cleaned_data['username'])
def testEmpty(self): form = AuthenticationForm(data={ 'username': '', 'password': '******' }) self.assertFalse(form.is_valid())
def testBadEmail(self): form = AuthenticationForm(data={ 'username': '******', 'password': '******' }) self.assertFalse(form.is_valid())