o
    ËjÞhæ  ã                   @   sˆ   d dl Zd dlm  mZ d dlZd dlmZ ejdd„ ƒZ	dd„ Z
dd„ Zd	d
„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )é    N)Úappc                   C   s   dt jd< t  ¡ S )NTÚTESTING)r   ÚconfigÚtest_client© r   r   ú=/home/cmiss/Jenkins/workspace/SPARC-API-DEV/tests/test_pmr.pyÚclient   s   
r   c                 C   ó˜   |   d¡}|j}d}||k}|sDt d|fd||f¡dt ¡ v s%t |¡r*t |¡ndt |¡t |¡dœ }dd|i }tt 	|¡ƒ‚d  } }}d S )	Nú	/pmr_fileé•  ©ú==©z3%(py2)s
{%(py2)s = %(py0)s.status_code
} == %(py5)sÚr©Úpy0Úpy2Úpy5úassert %(py7)sÚpy7©
ÚgetÚstatus_codeÚ
@pytest_arÚ_call_reprcompareÚ@py_builtinsÚlocalsÚ_should_repr_global_nameÚ	_safereprÚAssertionErrorÚ_format_explanation©r   r   Ú@py_assert1Ú@py_assert4Ú@py_assert3Ú@py_format6Ú@py_format8r   r   r   Útest_pmr_file   ó   
Žr'   c                 C   óœ   | j di d}|j}d}||k}|sFt d|fd||f¡dt ¡ v s't |¡r,t |¡ndt |¡t |¡dœ }dd	|i }tt 	|¡ƒ‚d  } }}d S )
Nr
   ©Újsoné  r   r   r   r   r   r   ©
Úpostr   r   r   r   r   r   r   r   r    r!   r   r   r   Útest_pmr_file_empty_post   ó   Žr/   c                 C   ó    | j dddid}|j}d}||k}|sHt d|fd||f¡dt ¡ v s)t |¡r.t |¡ndt |¡t |¡d	œ }d
d|i }tt 	|¡ƒ‚d  } }}d S )Nr
   Úpathzqworkspace/486/rawfile/55879cbc485e2d4c41f3dc6d60424b849f94c4ee/HumanSAN_Fabbri_Fantini_Wilders_Severi_2017.cellmlr*   éÈ   r   r   r   r   r   r   r-   r!   r   r   r   Útest_pmr_file_valid_path   ó   Žr4   c                 C   r1   )Nr
   r2   Zinvalid_pathr*   r,   r   r   r   r   r   r   r-   r!   r   r   r   Útest_pmr_file_invalid_path   r5   r6   c                 C   r	   )	Nú/pmr_latest_exposurer   r   r   r   r   r   r   r   r!   r   r   r   Ú test_pmr_latest_exposure_no_post   r(   r8   c                 C   r)   )
Nr7   r*   r,   r   r   r   r   r   r   r-   r!   r   r   r   Ú#test_pmr_latest_exposure_empty_post$   r0   r9   c                 C   ó  | j dddid}|j}d}||k}|sHt d|fd||f¡dt ¡ v s)t |¡r.t |¡ndt |¡t |¡d	œ }d
d|i }tt 	|¡ƒ‚d  } }}| 
¡ }|d }d}||k}	|	st d|	fd||f¡t |¡t |¡dœ }
dd|
i }tt 	|¡ƒ‚d  } }	}d S )Nr7   Úworkspace_urlz0https://models.physiomeproject.org/workspace/486r*   r3   r   r   r   r   r   r   Úurlz(https://models.physiomeproject.org/e/611©z%(py1)s == %(py4)s©Úpy1Úpy4úassert %(py6)sÚpy6©r.   r   r   r   r   r   r   r   r   r    Úget_json©r   r   r"   r#   r$   r%   r&   ÚdataÚ@py_assert0Ú@py_assert2Ú@py_format5Ú@py_format7r   r   r   Ú7test_pmr_latest_exposure_workspace_with_latest_exposure)   ó   ŠnrK   c                 C   r:   )Nr7   r;   z0https://models.physiomeproject.org/workspace/698r*   r3   r   r   r   r   r   r   r<   Ú r=   r>   rA   rB   rC   rE   r   r   r   Ú:test_pmr_latest_exposure_workspace_without_latest_exposure0   rL   rN   c                 C   r1   )Nr7   r;   zhttps://some.url.com/r*   r,   r   r   r   r   r   r   r-   r!   r   r   r   Ú=test_pmr_latest_exposure_workspace_with_invalid_workspace_url7   r5   rO   )Úbuiltinsr   Ú_pytest.assertion.rewriteÚ	assertionÚrewriter   Úpytestr   Úfixturer   r'   r/   r4   r6   r8   r9   rK   rN   rO   r   r   r   r   Ú<module>   s   " 
