
    .~h	                         d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ  e	d	d
dd       G d de             Zy)    )helpers)mail)TestCase)Client)override_settings)reverse)RegistrationProfile)	UserModel   zregistration@email.comTzdjango@email.com)ACCOUNT_ACTIVATION_DAYSREGISTRATION_DEFAULT_FROM_EMAILREGISTRATION_EMAIL_HTMLDEFAULT_FROM_EMAILc                   "    e Zd ZdZd Zd Zd Zy)AdminCustomActionsTestCasez1
    Test the available admin custom actions
    c                     t               | _        t               j                  j	                  ddd      }| j                  j                  |j                         |       dddd| _        y )Nadminzadmin@test.com)usernamepasswordalice	swordfishzalice@example.com)r   r   email)r   clientr
   objectscreate_superuserloginget_username	user_info)self
admin_users     i/var/www/peopleoo.sandbox-dev.co.uk/venv/lib/python3.12/site-packages/registration/tests/admin_actions.pysetUpz AdminCustomActionsTestCase.setUp   s]    h[((99%w0
:#:#:#<zR&-&1#68    c                     t               j                  j                  di | j                  }t        j                  j                  |      }| j                  |j                         t        d      }ddt        j                  |j                  gi}| j                  j                  ||d       t        j                  j                  |      }| j                  |j                         y)	zA
        Test the admin custom command 'activate users'

        1admin:registration_registrationprofile_changelistactionactivate_usersTfollow)userN )r
   r   create_userr   r	   create_profileassertFalse	activatedr   r   ACTION_CHECKBOX_NAMEpkr   postget
assertTruer   new_userprofileregistrationprofile_list	post_datas        r!   test_activate_usersz.AdminCustomActionsTestCase.test_activate_users   s    
 39;&&22DT^^D%--<<XF**+#*?$A  &((7::,
	 	19TJ%--11x1@))*r#   c                     t               j                  j                  d
i | j                  }t        j                  j                  |      }t        d      }ddt        j                  |j                  gi}| j                  j                  ||d       | j                  t        t        j                        d       | j                  t        j                  d   j                   | j                  d   g       y	)zI
        Test the admin custom command 'resend activation email'
        r%   r&   resend_activation_emailTr(      r   r   Nr+   )r
   r   r,   r   r	   r-   r   r   r0   r1   r   r2   assertEquallenr   outboxtor5   s        r!   test_resend_activation_emailz7AdminCustomActionsTestCase.test_resend_activation_email4   s     39;&&22DT^^D%--<<XF#*?$A  /((7::,
	 	19TJT[[)1-Q**T^^G-D,EFr#   N)__name__
__module____qualname____doc__r"   r:   rB   r+   r#   r!   r   r      s    
8+*Gr#   r   N)django.contrib.adminr   django.corer   django.testr   django.test.clientr   django.test.utilsr   django.urlsr   registration.modelsr	   registration.usersr
   r   r+   r#   r!   <module>rO      sK    (    % /  3 ( 13K+/&8:4G 4G	:4Gr#   