
    ^h-                         S r SSKrSSKrSSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJr  SS	KJrJrJr  S
 r " S S\R*                  5      rg)zTest the bundlerextension CLI.    N)patch)TemporaryDirectory)	py3compatcheck_help_all_output)BaseJSONConfigManager   )_get_config_direnable_bundler_pythondisable_bundler_pythonc                  N    [        S5        [        SS/5        [        SS/5        g )Nz#nbclassic.bundler.bundlerextensionsenabledisabler        g/home/james-whalen/.local/lib/python3.13/site-packages/nbclassic/bundler/tests/test_bundlerextension.pytest_help_outputr      s%    ?@?(L?)Mr   c                   0    \ rS rSrSrS rS rS rS rSr	g)	TestBundlerExtensionCLI   z?Tests the bundlerextension CLI against the example zip_bundler.c                    [        5       n[        R                  " UR                  5      U l        [
        R                  R                  U R                  S5      U l        [
        R                  R                  U R                  S5      U l	        [
        R                  R                  U R                  S5      U l
        U R                  /U l        [        R                  " SU R                  U R                  S.5      U l        U R                  R                  5         [        R                   " ["        SU R                  5      U l        U R$                  R                  5         g)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tds     r   setUpTestBundlerExtensionCLI.setUp   s    !!..rww7T]]F;'',,t}}h?!ww||DMM=I 001 L"&// $3
  	!&l!4#3#3"5$$&r   c                     [         R                  " U R                  SS9  U R                  R	                  5         U R
                  R	                  5         g)z#Remove the test config environment.T)ignore_errorsN)shutilrmtreer    r)   stopr-   )r.   s    r   tearDown TestBundlerExtensionCLI.tearDown0   s6    dmm48##%r   c                    [        S5        [        R                  R                  [	        SS9S5      n[        US9nUR                  S5      R                  S0 5      nU R                  [        U5      S5        U R                  S	U5        g
)z5Should add the bundler to the notebook configuration.nbclassic.bundler.zip_bundlerTusernbconfigr%   notebookbundlerextensions   notebook_zip_downloadN)
r   r!   r"   r#   r
   r   getassertEquallenassertInr.   r%   cmbundlerss       r   test_enable#TestBundlerExtensionCLI.test_enable6   sm    =>WW\\/t"<jI
"j966*%))*=rBX*-x8r   c                    U R                  5         [        S5        [        R                  R	                  [        SS9S5      n[        US9nUR                  S5      R                  S0 5      nU R                  [        U5      S5        g	)
z:Should remove the bundler from the notebook configuration.r:   Tr;   r=   r>   r?   r@   r   N)
rJ   r   r!   r"   r#   r
   r   rC   rD   rE   rG   s       r   test_disable$TestBundlerExtensionCLI.test_disable@   sj    >?WW\\/t"<jI
"j966*%))*=rBX*r   )r%   r$   r)   r-   r&   r'   r    N)
__name__
__module____qualname____firstlineno____doc__r0   r7   rJ   rM   __static_attributes__r   r   r   r   r      s    I'(&9+r   r   )rS   r!   r4   unittestunittest.mockr   ipython_genutils.tempdirr   ipython_genutilsr   traitlets.tests.utilsr   nbclassic.nbextensionsr,   nbclassic.config_managerr   r@   r
   r   r   r   TestCaser   r   r   r   <module>r]      sG    $
 
    7 & 7 - : N
.+h// .+r   