o
    Lf
                     @   sj   d dl mZmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
mZmZ ddlmZ G dd	 d	eeZd
S )    )parse_qsurlparse)reverse)	urlencode)OAuth2TestsMixin)MockedResponseTestCasemocked_response   )NotionProviderc                   @   s2   e Zd ZejZdZdd ZdddZdd	d
Z	dS )NotionTestsFc                 C   s
   t ddS )N   a|  
            {
                "workspace_id": "workspace-abc",
                "owner": {
                    "user": {
                        "id": "test123",
                        "name": "John Doe",
                        "avatar_url": "",
                        "person": {"email": "john@example.com"},
                    }
                },
            }
            )r   )self r   m/var/www/html/humari/django-venv/lib/python3.10/site-packages/allauth/socialaccount/providers/notion/tests.pyget_mocked_response   s   zNotionTests.get_mocked_responsec                 C   s   dS )z
        Docs here:
        https://developers.notion.com/docs/authorization#step-4-notion-responds-with-an-access_token-and-additional-information
        a  
        {
            "access_token": "testac",
            "bot_id": "bot-abc",
            "duplicated_template_id": "template-abc",
            "owner": {
            "workspace_id": "workspace-abc",
                "user": {
                    "id": "test123",
                    "name": "John Doe",
                    "avatar_url": "",
                    "person": {
                        "email": "john@example.com"
                    }
                }
            },
            "workspace_icon": "https://example.com/icon.png",
            "workspace_id": "workspace-abc",
            "workspace_name": "My Workspace"
        }
        r   )r   with_refresh_tokenr   r   r   get_login_response_json"   s   z#NotionTests.get_login_response_jsonNloginTc           
      C   s   | j t| jjd d tt|d }t|d }t|j	}t| jjd }| j
|d}t|tr6|}	n
|d u r=g }	n|g}	ttd|dd	ig|	R   | j || |}W d    |S 1 sdw   Y  |S )
N_login?)processlocation	_callback)r   r   zcontent-typezapplication/json)clientpostr   provideridr   dictr   r   queryr   
isinstancelistr	   r   getget_complete_parameters)
r   	resp_mockr   r   resppqcomplete_urlresponse_json
resp_mocksr   r   r   r   =   s8   



zNotionTests.login)F)Nr   T)
__name__
__module____qualname__r   r   provider_idpkce_enabled_defaultr   r   r   r   r   r   r   r      s    
r   N)urllib.parser   r   django.urlsr   django.utils.httpr   allauth.socialaccount.testsr   allauth.testsr   r   r	   r   r   r   r   r   r   r   <module>   s    