def test_user_email_unique(self): email = factory.make_email() User.objects.create_user( username=factory.make_string(), email=email) self.assertRaises( IntegrityError, User.objects.create_user, username=factory.make_string(), email=email)
def test_password_not_required_with_external_auth(self): Config.objects.set_config( 'external_auth_url', 'http://auth.example.com') form = NewUserCreationForm() params = { 'email': factory.make_email(), 'username': factory.make_name('user')} form = NewUserCreationForm(params) user = form.save() self.assertFalse(user.has_usable_password())
def test_password_not_required_with_external_auth(self): Config.objects.set_config("external_auth_url", "http://auth.example.com") form = NewUserCreationForm() params = { "email": factory.make_email(), "username": factory.make_name("user"), } form = NewUserCreationForm(params) user = form.save() self.assertFalse(user.has_usable_password())