Esempio n. 1
0
 def test_user_reg_form_failure(self):
     # Every field is required, password length should be >= 5
     form_data = {
         'osf_id': 'thisiswaytoolong',
     }
     form = UserRegistrationForm(form_data)
     self.assertFalse(form.is_valid())
Esempio n. 2
0
 def test_add_user(self, mock_save):
     count = OSFUser.objects.count()
     self.data.update(osf_id=self.user._id)
     form = UserRegistrationForm(data=self.data)
     nt.assert_true(form.is_valid())
     view = setup_form_view(self.view, self.request, form)
     view.form_valid(form)
     nt.assert_true(mock_save.called)
     nt.assert_equal(OSFUser.objects.count(), count + 1)
Esempio n. 3
0
 def test_user_reg_form_success(self):
     form_data = {
         'email': '*****@*****.**',
         'first_name': 'Zak',
         'last_name': 'K',
         'password1': 'password',
         'password2': 'password',
         'osf_id': 'abc12',
     }
     form = UserRegistrationForm(form_data)
     self.assertTrue(form.is_valid())
Esempio n. 4
0
 def test_user_reg_form_failure(self):
     # Every field is required, password length should be >= 5
     form_data = {
         'email': '',
         'first_name': '',
         'last_name': '',
         'password1': 'pass',
         'password2': 'pass',
     }
     form = UserRegistrationForm(form_data)
     self.assertFalse(form.is_valid())
Esempio n. 5
0
 def test_osf_id_invalid(self):
     form = UserRegistrationForm(data=self.data)
     nt.assert_true(form.is_valid())
     view = setup_form_view(self.view, self.request, form)
     with nt.assert_raises(Http404):
         view.form_valid(form)
Esempio n. 6
0
 def test_user_reg_form_success(self):
     form_data = {
         'osf_id': 'abc12',
     }
     form = UserRegistrationForm(form_data)
     self.assertTrue(form.is_valid())