a ,"?g@sddlZddlmmZddlZddlZddlmZej ddZ ddZ ddZ d d Z d d Zd dZddZddZddZddZddZddZddZddZdd ZdS)!N)appcCsdtjd<tS)NTTESTING)rconfig test_clientrr@/home/cmiss/Jenkins/workspace/SPARC-API-DEV/tests/test_osparc.pyclients rcCs|d}|j}d}||k}|std|fd||fdtvsJt|rTt|ndt|t|d}dd|i}tt |d}}}dS) N/start_simulation==z3%(py2)s {%(py2)s = %(py0)s.status_code } == %(py5)srpy0py2py5assert %(py7)spy7 get status_code @pytest_ar_call_reprcompare @py_builtinslocals_should_repr_global_name _safereprAssertionError_format_explanationrr @py_assert1 @py_assert4 @py_assert3 @py_format6 @py_format8rrr$test_osparc_start_simulation_no_post s r&cCs|d}|j}d}||k}|std|fd||fdtvsJt|rTt|ndt|t|d}dd|i}tt |d}}}dS) N/check_simulationr r r rrrrrr rrr$test_osparc_check_simulation_no_posts r(cCs|jdid}|j}d}||k}|std|fd||fdtvsNt|rXt|ndt|t|d}dd |i}tt |d}}}dS Nr jsonr r rrrr postrrrrrrrrrr rrr'test_osparc_start_simulation_empty_postsr/cCs|jdid}|j}d}||k}|std|fd||fdtvsNt|rXt|ndt|t|d}dd |i}tt |d}}}dS Nr'r*r,r r rrrrr-r rrr'test_osparc_check_simulation_empty_postsr1cCsi}|jd|d}|j}d}||k}|std|fd||fdtvsRt|r\t|ndt|t|d}dd |i}tt |d}}}dSr)r-rdatarr!r"r#r$r%rrr$test_osparc_start_simulation_no_data sr4cCsddddi}|jd|d}|j}d}||k}|std|fd ||fd tvs\t|rft|nd t|t|d }d d |i}tt |d}}}dS)Nsolversimcore/services/comp/opencor1.0.3nameversionr r*r,r r rrrrr-r2rrr,test_osparc_start_simulation_no_opencor_data'sr;cCsddddi}|jd|d}|j}d}||k}|std|fd ||fd tvs\t|rft|nd t|t|d }d d |i}tt |d}}}dS)Nr5z0simcore/services/comp/rabbit-ss-0d-cardiac-modelz1.0.1r8r r*r,r r rrrrr-r2rrr+test_osparc_start_simulation_no_osparc_data2sr<cCsddddi}|jd|d}|j}d}||k}|std|fd ||fd tvs\t|rft|nd t|t|d }d d |i}tt |d}}}dS)Nr5r6r7r8r'r*r,r r rrrrr-r2rrr+test_osparc_check_simulation_no_job_id_data=sr=cCsddi}|jd|d}|j}d}||k}|std|fd||fdtvsVt|r`t|ndt|t|d }d d |i}tt |d}}}dS) Njob_id$5026ff74-dc6d-4547-9166-6ae26d04b92er'r*r,r r rrrrr-r2rrr+test_osparc_check_simulation_no_solver_dataHsr@cCsdddid}|jd|d}|j}d}||k}|std|fd ||fd tvs\t|rft|nd t|t|d }d d |i}tt |d}}}dS)Nr?r:r7r>r5r'r*r,r r rrrrr-r2rrr0test_osparc_check_simulation_no_solver_name_dataPs rBcCsdddid}|jd|d}|j}d}||k}|std|fd ||fd tvs\t|rft|nd t|t|d }d d |i}tt |d}}}dS)Nr?r9r6rAr'r*r,r r rrrrr-r2rrr3test_osparc_check_simulation_no_solver_version_data[s rCcCsi}|jd|d}|j}d}||k}|std|fd||fdtvsRt|r\t|ndt|t|d}dd |i}tt |d}}}dSr0r-r2rrr$test_osparc_check_simulation_no_datafsrDc CsHdddddgdddd d d }d gd gddd}|jd|d}|j}d}||k}|std|fd||fdtvst|rt|ndt|t|d}dd|i}tt |d}}}t |j } | d} } d}| |u} | sFtd| fd| |ft| t|d} dd| i}tt |d} } }d } | | k}|std|fd | | fdtvst| rt| ndt| d!}d"d#|i}tt |d}} | d$}} d}| |u} | s6td| fd| |ft| t|d} dd| i}tt |d} } }|jd%|d}|j}d}||k}|std|fd||fdtvst|rt|ndt|t|d}dd|i}tt |d}}}t |j } | d} } d}| |u} | sRtd| fd| |ft| t|d} dd| i}tt |d} } }d } | | k}|std|fd | | fdtvst| rt| ndt| d!}d"d#|i}tt |d}} | d&r@t j}d'}|| |d(}t j}d'}|||d(}||k}|s td|fd)||fd*tvsPtt rZtt nd*t|d+tvs~t| rt| nd+t|t|d*tvstt rtt nd*t|d,tvst|rt|nd,t|t|d- }d.d/|i}tt |d}}}}}}}qDqBdS)0N[https://models.physiomeproject.org/e/611/HumanSAN_Fabbri_Fantini_Wilders_Severi_2017.cellml~jth?MbP?z Ending pointzPoint interval Membrane/V simulationoutput model_url json_configr6r7r8opencorr5ok)grGgMb`?rF)g:GgkGgGgPZG)zenvironment/timerI)statusresultsr r*r r rrrrrSis notz%(py1)s is not %(py4)spy1py4assert %(py6)spy6z%(py0)s == %(py3)srpy3assert %(py5)srr3r'rTT sort_keysz%(py7)s {%(py7)s = %(py2)s {%(py2)s = %(py0)s.dumps }(%(py3)s, sort_keys=%(py5)s) } == %(py16)s {%(py16)s = %(py11)s {%(py11)s = %(py9)s.dumps }(%(py12)s, sort_keys=%(py14)s) }r+ json_datares rrr`rrpy9py11Zpy12Zpy14Zpy16assert %(py18)spy18r.rrrrrrrrrr+loadsr3rdumpsrr3rfrr!r"r#r$r%rerS @py_assert0 @py_assert2 @py_format5 @py_format7 @py_format4Zcheck_simulation_data @py_assert6 @py_assert10Z @py_assert13Z @py_assert15 @py_assert8Z @py_format17Z @py_format19rrr!test_osparc_successful_simulationms>  r~r r~ Urxc Csdddddgdddd d d }d d d}|jd|d}|j}d}||k}|std|fd||fdtvs|t|rt|ndt|t|d}dd|i}tt |d}}}t |j } | d} } d}| |u} | s8td| fd| |ft| t|d} dd| i}tt |d} } }d} | | k}|std|fd| | fdtvst| rt| ndt| d }d!d"|i}tt |d}} | d#}} d}| |u} | s(td| fd| |ft| t|d} dd| i}tt |d} } }|jd$|d}|j}d}||k}|std|fd||fdtvst|rt|ndt|t|d}dd|i}tt |d}}}t |j } | d} } d}| |u} | sDtd| fd| |ft| t|d} dd| i}tt |d} } }| d krt j}d%}|| |d&}t j}d%}|||d&}||k}|std|fd'||fd(tvstt rtt nd(t|d)tvst| rt| nd)t|t|d(tvs&tt r0tt nd(t|d*tvsTt|r^t|nd*t|t|d+ }d,d-|i}tt |d}}}}}}}qq4dS).NrEg@g?rHrIrJrMr6r7r8rPnokzthe simulation failed)rS descriptionr r*rUr r rrrrrSrVrXrYr\r]rRr^r_rarr3r'Trbrdr+rerfrgrjrkrlrorrrtest_osparc_failing_simulations8  r~r r Ur{)builtinsr_pytest.assertion.rewrite assertionrewriterr+pytestrfixturerr&r(r/r1r4r;r<r=r@rBrCrDrxr{rrrrs$"       )