o
    i6                     @   s\   d 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 G dd	 d	eZdS )
zTest the /tree handlers    N)url_path_join)write)new_notebook)urlparse)NotebookTestBasec                   @   s   e Zd Zdd Zdd ZdS )TreeTestc                 C   s   | j }tj|d}t| ttj|dddd}t }t||dd W d    n1 s0w   Y  ttj|dddd}|d	 W d    n1 sQw   Y  |   d S )
Nfooz	bar.ipynbwzutf-8)encoding   )versionzbaz.txtflamingo)	notebook_dirospathjoinmkdiropenr   r   base_url)selfnbdirdfnb r   `/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/notebook/tree/tests/test_tree_handler.pysetUp   s   
zTreeTest.setUpc                 C   sf   |  dd}| |j|  d  | j dddd}| |jd | |jd tt|  d	j d S )
NGETztree/foo/bar.ipynbznotebooks/foo/bar.ipynbztree/foo/baz.txtF)allow_redirectsi.  Locationzfiles/foo/baz.txt)	requestassertEqualurlr   status_codeheadersr   r   r   )r   rr   r   r   test_redirect   s   zTreeTest.test_redirectN)__name__
__module____qualname__r   r&   r   r   r   r   r   
   s    r   )__doc__r   notebook.utilsr   nbformatr   nbformat.v4r   urllib.parser   notebook.tests.launchnotebookr   r   r   r   r   r   <module>   s    