예제 #1
0
 def test_user_model_admin_custom_add_form(self):
     user_model_admin = UserAdmin(User, self.site)
     form = user_model_admin.add_form()
     self.assertEqual(type(form), UserCreationForm)
예제 #2
0
 def test_add_form_email_field_is_required(self):
     user_model_admin = UserAdmin(User, self.site)
     form = user_model_admin.add_form()
     field = form.declared_fields['email']
     self.assertTrue(field.required)
예제 #3
0
 def test_user_model_admin_custom_change_form(self):
     user_model_admin = UserAdmin(User, self.site)
     form = user_model_admin.form()
     self.assertEqual(type(form), UserChangeForm)
예제 #4
0
 def test_add_form_email_field_is_required(self):
     user_model_admin = UserAdmin(User, self.site)
     form = user_model_admin.add_form()
     field = form.declared_fields['email']
     self.assertTrue(field.required)
예제 #5
0
 def test_user_model_admin_custom_add_form(self):
     user_model_admin = UserAdmin(User, self.site)
     form = user_model_admin.add_form()
     self.assertEqual(type(form), UserCreationForm)
예제 #6
0
 def test_user_model_admin_custom_change_form(self):
     user_model_admin = UserAdmin(User, self.site)
     form = user_model_admin.form()
     self.assertEqual(type(form), UserChangeForm)
예제 #7
0
 def test_user_model_admin_requires_email_field(self):
     user_model_admin = UserAdmin(User, self.site)
     add_fieldsets = user_model_admin.add_fieldsets
     add_fiels = add_fieldsets[0][1]['fields']
     self.assertIn('email', add_fiels)