コード例 #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)