예제 #1
0
파일: test_user.py 프로젝트: zhangrb/maas
 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']))
예제 #2
0
파일: test_user.py 프로젝트: ocni-dtu/maas
 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"]))
예제 #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']))
예제 #4
0
파일: test_user.py 프로젝트: zhangrb/maas
 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']))
예제 #5
0
파일: test_user.py 프로젝트: ocni-dtu/maas
 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"]))
예제 #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']))
예제 #7
0
파일: test_user.py 프로젝트: uraniid/maas
 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())
예제 #8
0
파일: test_user.py 프로젝트: ocni-dtu/maas
 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())