a á†mgæã@sˆddlZddlmmZddlZddlmZejdd„ƒZ dd„Z dd„Z d d „Z d d „Z d d„Zdd„Zdd„Zdd„Zdd„ZdS)éN)ÚappcCsdtjd<t ¡S)NTÚTESTING)rÚconfigÚ test_client©rrú9/home/cmiss/Jenkins/workspace/SPARC-API/tests/test_pmr.pyÚclients rcCs˜| d¡}|j}d}||k}|sˆt d|fd||f¡dt ¡vsJt |¡rTt |¡ndt |¡t |¡dœ}dd|i}tt  |¡ƒ‚d}}}dS) 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©rrÚ @py_assert1Ú @py_assert4Ú @py_assert3Ú @py_format6Ú @py_format8rrrÚ test_pmr_file s r&cCsœ|jdid}|j}d}||k}|sŒt d|fd||f¡dt ¡vsNt |¡rXt |¡ndt |¡t |¡dœ}dd |i}tt  |¡ƒ‚d}}}dS) Nr ©Újsonér r rrrr© Úpostrrrrrrrrrr rrrÚtest_pmr_file_empty_postsr,cCs |jdddid}|j}d}||k}|st d|fd||f¡dt ¡vsRt |¡r\t |¡ndt |¡t |¡d œ}d d |i}tt  |¡ƒ‚d}}}dS) Nr Úpathzqworkspace/486/rawfile/55879cbc485e2d4c41f3dc6d60424b849f94c4ee/HumanSAN_Fabbri_Fantini_Wilders_Severi_2017.cellmlr'éÈr r rrrrr*r rrrÚtest_pmr_file_valid_pathsr/cCs |jdddid}|j}d}||k}|st d|fd||f¡dt ¡vsRt |¡r\t |¡ndt |¡t |¡d œ}d d |i}tt  |¡ƒ‚d}}}dS) Nr r-Z invalid_pathr'r)r r rrrrr*r rrrÚtest_pmr_file_invalid_pathsr0cCs˜| d¡}|j}d}||k}|sˆt d|fd||f¡dt ¡vsJt |¡rTt |¡ndt |¡t |¡dœ}dd|i}tt  |¡ƒ‚d}}}dS) Nú/pmr_latest_exposurer r r rrrrrr rrrÚ test_pmr_latest_exposure_no_posts r2cCsœ|jdid}|j}d}||k}|sŒt d|fd||f¡dt ¡vsNt |¡rXt |¡ndt |¡t |¡dœ}dd |i}tt  |¡ƒ‚d}}}dS) Nr1r'r)r r rrrrr*r rrrÚ#test_pmr_latest_exposure_empty_post$sr3c Cs|jdddid}|j}d}||k}|st d|fd||f¡dt ¡vsRt |¡r\t |¡ndt |¡t |¡d œ}d d |i}tt  |¡ƒ‚d}}}|  ¡}|d }d }||k} | st d| fd||f¡t |¡t |¡dœ} dd| i} tt  | ¡ƒ‚d}} }dS)Nr1Ú workspace_urlz0https://models.physiomeproject.org/workspace/486r'r.r r rrrrÚurlz(https://models.physiomeproject.org/e/611©z%(py1)s == %(py4)s©Úpy1Úpy4úassert %(py6)sÚpy6© r+rrrrrrrrrÚget_json© rrr!r"r#r$r%ÚdataÚ @py_assert0Ú @py_assert2Ú @py_format5Ú @py_format7rrrÚ7test_pmr_latest_exposure_workspace_with_latest_exposure)sŠrDc Cs|jdddid}|j}d}||k}|st d|fd||f¡dt ¡vsRt |¡r\t |¡ndt |¡t |¡d œ}d d |i}tt  |¡ƒ‚d}}}|  ¡}|d }d }||k} | st d| fd||f¡t |¡t |¡dœ} dd| i} tt  | ¡ƒ‚d}} }dS)Nr1r4z0https://models.physiomeproject.org/workspace/698r'r.r r rrrrr5Úr6r7r:r;r<r>rrrÚ:test_pmr_latest_exposure_workspace_without_latest_exposure0sŠrFcCs |jdddid}|j}d}||k}|st d|fd||f¡dt ¡vsRt |¡r\t |¡ndt |¡t |¡d œ}d d |i}tt  |¡ƒ‚d}}}dS) Nr1r4zhttps://some.url.com/r'r)r r rrrrr*r rrrÚ=test_pmr_latest_exposure_workspace_with_invalid_workspace_url7srG)ÚbuiltinsrÚ_pytest.assertion.rewriteÚ assertionÚrewriterÚpytestrÚfixturerr&r,r/r0r2r3rDrFrGrrrrÚs"