def test_activate_users(self):
"""
Test the admin custom command 'activate users'
"""
new_user = UserModel().objects.create_user(**self.user_info)
profile = RegistrationProfile.objects.create_profile(new_user)
self.assertFalse(profile.activated)
registrationprofile_list = urlresolvers.reverse('admin:registration_registrationprofile_changelist')
post_data = {
'action': 'activate_users',
helpers.ACTION_CHECKBOX_NAME: [profile.pk],
}
self.client.post(registrationprofile_list, post_data, follow=True)
profile = RegistrationProfile.objects.get(user=new_user)
self.assertTrue(profile.activated)
评论列表
文章目录