o
    id                     @   s   d Z ddlZddlZddl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mZmZ d
d ZG dd dejZdS )zTest the bundlerextension CLI.    N)patch)TemporaryDirectory)	py3compatcheck_help_all_output)BaseJSONConfigManager   )_get_config_direnable_bundler_pythondisable_bundler_pythonc                   C   s$   t d t ddg t ddg d S )Nz"notebook.bundler.bundlerextensionsenabledisabler    r   r   g/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/notebook/bundler/tests/test_bundlerextension.pytest_help_output   s   r   c                   @   s0   e Zd ZdZdd Zdd Zdd Zdd	 Zd
S )TestBundlerExtensionCLIz?Tests the bundlerextension CLI against the example zip_bundler.c                 C   s   t  }t|j| _tj| jd| _tj| jd| _	tj| jd| _
| j
g| _td| j	| jd| _| j  ttd| j| _| j  dS )z%Build an isolated config environment.dataconfigsystem_dataz
os.environ)JUPYTER_CONFIG_DIRJUPYTER_DATA_DIRSYSTEM_JUPYTER_PATHN)r   r   cast_unicodenametest_dirospathjoindata_dir
config_dirsystem_data_dirsystem_pathr   dict	patch_envstartobjectnbextensionspatch_system_path)selftdr   r   r   setUp   s   


zTestBundlerExtensionCLI.setUpc                 C   s(   t j| jdd | j  | j  dS )z#Remove the test config environment.T)ignore_errorsN)shutilrmtreer   r#   stopr'   )r(   r   r   r   tearDown0   s   
z TestBundlerExtensionCLI.tearDownc                 C   sX   t d tjtddd}t|d}|ddi }| t|d | 	d	| d
S )z5Should add the bundler to the notebook configuration.notebook.bundler.zip_bundlerTusernbconfigr   notebookbundlerextensions   notebook_zip_downloadN)
r
   r   r   r   r	   r   getassertEquallenassertInr(   r   cmbundlersr   r   r   test_enable6   s   
z#TestBundlerExtensionCLI.test_enablec                 C   sT   |    td tjtddd}t|d}|ddi }| t	|d d	S )
z:Should remove the bundler from the notebook configuration.r0   Tr1   r3   r4   r5   r6   r   N)
r@   r   r   r   r   r	   r   r9   r:   r;   r=   r   r   r   test_disable@   s   
z$TestBundlerExtensionCLI.test_disableN)__name__
__module____qualname____doc__r*   r/   r@   rA   r   r   r   r   r      s    
r   )rE   r   r,   unittestunittest.mockr   ipython_genutils.tempdirr   ipython_genutilsr   traitlets.tests.utilsr   notebook.nbextensionsr&   notebook.config_managerr   r6   r	   r
   r   r   TestCaser   r   r   r   r   <module>   s    