Esempio n. 1
0
 def test_saves_to_db_by_default(self):
     password = factory.make_name('password')
     params = {
         'email': '*****@*****.**' % factory.make_string(),
         'username': factory.make_name('user'),
         'password1': password,
         'password2': password,
     }
     form = NewUserCreationForm(params)
     form.save()
     self.assertIsNotNone(User.objects.get(username=params['username']))
Esempio n. 2
0
 def test_saves_to_db_by_default(self):
     password = factory.make_name("password")
     params = {
         "email": "*****@*****.**" % factory.make_string(),
         "username": factory.make_name("user"),
         "password1": password,
         "password2": password,
     }
     form = NewUserCreationForm(params)
     form.save()
     self.assertIsNotNone(User.objects.get(username=params["username"]))
Esempio n. 3
0
 def test_saves_to_db_by_default(self):
     password = factory.make_name('password')
     params = {
         'email': '*****@*****.**' % factory.getRandomString(),
         'username': factory.make_name('user'),
         'password1': password,
         'password2': password,
     }
     form = NewUserCreationForm(params)
     form.save()
     self.assertIsNotNone(User.objects.get(username=params['username']))
Esempio n. 4
0
 def test_does_not_save_to_db_if_commit_is_False(self):
     password = factory.make_name('password')
     params = {
         'email': '*****@*****.**' % factory.make_string(),
         'username': factory.make_name('user'),
         'password1': password,
         'password2': password,
     }
     form = NewUserCreationForm(params)
     form.save(commit=False)
     self.assertItemsEqual([],
                           User.objects.filter(username=params['username']))
Esempio n. 5
0
 def test_does_not_save_to_db_if_commit_is_False(self):
     password = factory.make_name("password")
     params = {
         "email": "*****@*****.**" % factory.make_string(),
         "username": factory.make_name("user"),
         "password1": password,
         "password2": password,
     }
     form = NewUserCreationForm(params)
     form.save(commit=False)
     self.assertItemsEqual([],
                           User.objects.filter(username=params["username"]))
Esempio n. 6
0
 def test_does_not_save_to_db_if_commit_is_False(self):
     password = factory.make_name('password')
     params = {
         'email': '*****@*****.**' % factory.getRandomString(),
         'username': factory.make_name('user'),
         'password1': password,
         'password2': password,
     }
     form = NewUserCreationForm(params)
     form.save(commit=False)
     self.assertItemsEqual(
         [], User.objects.filter(username=params['username']))
Esempio n. 7
0
 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())
Esempio n. 8
0
 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())