o
    h	                     @   sn   d 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 G d
d deeZdS )z{
    Run just this suite:
    python manage.py test allauth.socialaccount.providers.trainingpeaks.tests.TrainingPeaksTests
    )
namedtuple)TestCase)override_settings)OAuth2TestsMixinMockedResponse   )TrainingPeaksProvider)TrainingPeaksOAuth2Adapterc                   @   st   e Zd ZejZdd Zdd ZdddZdd	 Z	e
d
ddiiddd Zdd Ze
d
dg diiddd ZdS )TrainingPeaksTestsc                 C   s
   t ddS )N   a(  {
                "Id": 123456,
                "FirstName": "John",
                "LastName": "Doe",
                "Email": "user@example.com",
                "DateOfBirth": "1986-02-01T00:00:00",
                "CoachedBy": 987654,
                "Weight": 87.5223617553711
            }r   self r   n/var/www/html/env_mimamsha/lib/python3.10/site-packages/allauth/socialaccount/providers/trainingpeaks/tests.pyget_mocked_response   s   z&TrainingPeaksTests.get_mocked_responsec                 C   s   dS )Nzuser@example.comr   r   r   r   r   get_expected_to_str#   s   z&TrainingPeaksTests.get_expected_to_strTc                 C   s   d}|rd}d| S )N z,"refresh_token": "testrf"z{
                "access_token" : "testac",
                "token_type" : "bearer",
                "expires_in" : 600,
                "scope": "scopes granted"
            %s }r   )r   with_refresh_tokenrtokenr   r   r   get_login_response_json&   s   z*TrainingPeaksTests.get_login_response_jsonc                 C   <   t d }| d|jv  | d|jv  | d|jv  d S Nz	.sandbox.)r
   
assertTrueauthorize_urlaccess_token_urlprofile_urlr   adapterr   r   r   test_default_use_sandbox_uri4   s   z/TrainingPeaksTests.test_default_use_sandbox_uritrainingpeaksUSE_PRODUCTION)SOCIALACCOUNT_PROVIDERSc                 C   r   r   )r
   assertFalser   r   r   r   r   r   r   test_use_production_uri:   s   z*TrainingPeaksTests.test_use_production_uric                 C   s4   t ddg}|i d}| j|}| d|v  d S )NrequestGETr&   athlete:profiler   providerget_scope_from_requestr   )r   Requestmock_requestscoper   r   r   test_scope_from_defaultC   s   
z*TrainingPeaksTests.test_scope_from_defaultSCOPEr(   workoutszworkouts:wodc                 C   s>   t ddg}|i d}| j|}dD ]	}| ||v  qd S )Nr%   r&   r'   r1   r)   )r   r,   r-   r.   itemr   r   r   test_scope_from_settingsI   s   
z+TrainingPeaksTests.test_scope_from_settingsN)T)__name__
__module____qualname__r	   idprovider_idr   r   r   r   r   r$   r/   r4   r   r   r   r   r      s     


r   N)__doc__collectionsr   django.testr   django.test.utilsr   allauth.socialaccount.testsr   allauth.testsr   r*   r	   viewsr
   r   r   r   r   r   <module>   s    