Пример #1
0
 def test_form_invalid_missing_fields(self):
     form_data = {
         'username': '******',
         'password': '******',
     }
     form = ClassAccountRequestForm(data=form_data)
     self.assertFalse(form.is_valid())
Пример #2
0
 def test_form_valid(self):
     form_data = {
         'username': '******',
         'password': '******',
         'course_number': 'CSCI4000',
         'login_shell': '/bin/bash',
     }
     form = ClassAccountRequestForm(data=form_data)
     self.assertTrue(form.is_valid())
     self.assertEqual(form.cleaned_data['role'], 'student')
     self.assertEqual(form.cleaned_data['organization'], 'ucb')