U
    [et                     @   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G dd deZG d	d
 d
eZ	dS )    N)AuthAlreadyAssociated)User)BaseActionTestc                       s0   e Zd ZdZ fddZdd Zdd Z  ZS )AssociateActionTestfoobarc                    s4   t t|   tddd| _| jjd| jj d S )Nr   foo@bar.comusernameemailr	   )	superr   setUpr   userbackendZstrategyZsession_setr	   self	__class__ e/var/www/html/services/stratfitenv/lib/python3.8/site-packages/social/tests/actions/test_associate.pyr      s    zAssociateActionTest.setUpc                 C   s6   |    | t| jjd | | jjd jd d S N   r   github)do_login
assertTruelenr   socialassertEqualproviderr   r   r   r   test_associate   s    z"AssociateActionTest.test_associatec                 C   s6   |    | t| jjd | | jjd jd d S r   )Zdo_login_with_partial_pipeliner   r   r   r   r   r   r   r   r   $test_associate_with_partial_pipeline   s    z8AssociateActionTest.test_associate_with_partial_pipeline)__name__
__module____qualname__Zexpected_usernamer   r   r   __classcell__r   r   r   r   r   	   s   r   c                   @   s\   e Zd Zeddddddddd	d
ddddddddddddddddddddZdd ZdS )MultipleAccountsTestfoobar2   z1https://github.com/images/error/foobar2_happy.gifZsomehexcodez$https://api.github.com/users/foobar2zmonalisa foobar2ZGitHubzhttps://github.com/blogzSan Franciscor   FzThere once was...r      r   zhttps://github.com/foobar2z2008-01-14T04:33:35Zr   d   Q   i'     ZMediumi  
   )namespacecollaboratorsZprivate_repos)loginidZ
avatar_urlZgravatar_idurlr,   ZcompanyZbloglocationr
   ZhireableZbioZpublic_reposZpublic_gistsZ	followersZ	followingZhtml_urlZ
created_attypeZtotal_private_reposZowned_private_reposZprivate_gists
disk_usager.   Zplanc                 C   sZ   |    | j | jd | t| jjd | | jjd jd | | jjd jd d S )N)Zuser_data_bodyr&   r   r   r   )r   alternative_user_data_bodyr   r   r   r   r   r   r   r   r   test_multiple_social_accounts>   s
    z2MultipleAccountsTest.test_multiple_social_accountsN)r    r!   r"   jsondumpsr5   r6   r   r   r   r   r$      s@   !r$   c                       s0   e Zd Z fddZ fddZdd Z  ZS )AlreadyAssociatedErrorTestc                    s&   t t|   tddd| _d | _d S )Nr   r   r   )r   r9   r   r   user1r   r   r   r   r   r   G   s    z AlreadyAssociatedErrorTest.setUpc                    s   t t|   d | _d | _d S )N)r   r9   tearDownr:   r   r   r   r   r   r;   L   s    z#AlreadyAssociatedErrorTest.tearDownc              	   C   sB   | j | _|   tddd| _| td |   W 5 Q R X d S )Nr%   zfoo2@bar2.comr   z&This github account is already in use.)r:   r   r   r   ZassertRaisesRegexpr   r   r   r   r   test_already_associated_errorQ   s    z8AlreadyAssociatedErrorTest.test_already_associated_error)r    r!   r"   r   r;   r<   r#   r   r   r   r   r9   F   s   r9   )
r7   Zsocial.exceptionsr   Zsocial.tests.modelsr   Zsocial.tests.actions.actionsr   r   r$   r9   r   r   r   r   <module>   s   *