
    .~h}                     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       G d	 d
e             Zy)    )settings)TestCase)override_settings)reverse)RegistrationForm)	UserModelztest_app.urls_simple)ROOT_URLCONFc                   Z    e Zd Z ed      d        Z ed      d        Zd Zd Zd Zy	)
SimpleBackendViewTestsT)REGISTRATION_OPENc                     | j                   j                  t        d            }| j                  d|j                         y)zv
        The setting ``REGISTRATION_OPEN`` appropriately controls
        whether registration is permitted.

        registration_register   N)clientgetr   assertEqualstatus_codeselfresps     j/var/www/peopleoo.sandbox-dev.co.uk/venv/lib/python3.12/site-packages/registration/tests/simple_backend.pytest_registration_openz-SimpleBackendViewTests.test_registration_open   s2     {{w'>?@d../    Fc                    | j                   j                  t        d            }| j                  |t        d             | j                   j	                  t        d      ddddd      }| j                  |t        d             y )Nr   registration_disallowedbobbob@example.comsecretusernameemail	password1	password2data)r   r   r   assertRedirectspostr   s     r   test_registration_closedz/SimpleBackendViewTests.test_registration_closed   s|    
 {{w'>?@T7+D#EF{{(? @27/@3;3;&=   >
 	T7+D#EFr   c                     | j                   j                  t        d            }| j                  d|j                         | j                  |d       | j                  |j                  d   t               y)z
        HTTP ``GET`` to the registration view uses the appropriate
        template and populates a registration form into the context.

        r   r   z#registration/registration_form.htmlformN)	r   r   r   r   r   assertTemplateUsedassertIsInstancecontextr   r   s     r   test_registration_getz,SimpleBackendViewTests.test_registration_get&   s`     {{w'>?@d../ E	Gdll624DEr   c                 l   | j                   j                  t        d      ddddd      }t               j                  j                  d      }| j                  d|j                         | j                  t        t        d	d
      |d          | j                  |j                  d             | j                  |j                  d       | j                  |j                         | j                   j                  t        d      d      }| j                  |j                  d   j                          y)zK
        Registration creates a new account and logs the user in.

        r   r   r   r   r   r$   )r    i.  SIMPLE_BACKEND_REDIRECT_URL/LocationT)followuserN)r   r'   r   r   objectsr   r   r   assertIngetattrr   
assertTruecheck_passwordr!   	is_activer-   is_authenticated)r   r   new_users      r   test_registrationz(SimpleBackendViewTests.test_registration2   s   
 {{(? @27/@3;3;&=   >
 ;&&**E*:d../gh(EsK:&	( 	//9:):; 	**+ {{w'>?MV,==>r   c                     | j                   j                  t        d      ddddd      }| j                  d|j                         | j                  |j                  d	   j                                y
)z7
        Registering with invalid data fails.

        r   r   r   r   	notsecretr   r$   r   r*   N)r   r'   r   r   r   assertFalser-   is_validr   s     r   test_registration_failurez0SimpleBackendViewTests.test_registration_failureK   sp    
 {{(? @27/@3;3>&@   A
 	d../f-6689r   N)	__name__
__module____qualname__r   r   r(   r.   r=   rB    r   r   r   r   
   sF     .0 /0 /G 0G
F?2:r   r   N)django.confr   django.testr   r   django.urlsr   registration.formsr   registration.usersr   r   rF   r   r   <module>rL      s;        )  / (  67K:X K: 8K:r   