3
( \                 @   s@   d dl Z d dlmZ d dlmZ d dlmZ G dd deZdS )    N)BaseTestGenerator)
test_utils)config_datac               @   s0  e Zd ZdZdeed d eej dd ddfd	eed d d
ddfded
ed d ddfded
d
ddfdeeej dd d ed d ddfdeeej dd d eej dd ddfdeed d ed d ded d  dfgZ	e
dd Zdd Zdd Ze
dd ZdS ) LoginTestCasez
    This class checks login functionality by validating different scenarios.
    Login scenarios are defined in dictionary; where dict of parameters
    describe the scenario appended by test name.
    z&TestCase for Checking Invalid_PasswordZpgAdmin4_login_credentialsZlogin_username      zInvalid password)emailpasswordrespdataZEmpty_Password zPassword not providedZEmpty_EmailZlogin_passwordzEmail not providedZEmpty_CredentialsZInvalid_Email   z@xyz.comzSpecified user does not existZInvalid_CredentialsZValid_CredentialszGravatar image for %sc             C   s   t j| j dS )z
        We need to logout the test client as we are testing scenarios of
        logging in the client like invalid password, invalid emails,
        empty credentials etc.
        N)utilsZlogout_tester_accounttester)cls r   ;/usr/share/pgadmin4/web/pgadmin/browser/tests/test_login.py
setUpClassP   s    zLoginTestCase.setUpClassc             C   s   d S )Nr   )selfr   r   r   setUpZ   s    zLoginTestCase.setUpc             C   s:   | j jdt| j| jddd}| j| j|jjdk dS )z)This function checks login functionality.z/login)r   r	   T)dataZfollow_redirectsutf8N)	r   Zpostdictr   r	   Z
assertTruer
   r   decode)r   Zresponser   r   r   runTest]   s    zLoginTestCase.runTestc             C   s   t j| j dS )zd
        We need to again login the test client as soon as test scenarios
        finishes.
        N)r   Zlogin_tester_accountr   )r   r   r   r   tearDownClassi   s    zLoginTestCase.tearDownClassN)__name__
__module____qualname____doc__r   r   struuidZuuid4Z	scenariosclassmethodr   r   r   r   r   r   r   r   r      sN   
r   )	r    Zpgadmin.utils.router   Zregression.python_test_utilsr   r   Zregression.test_setupr   r   r   r   r   r   <module>
   s   