a UmgU @szddlZddlmmZddlZddlmZddl m Z ej ddZ ej ddZ dd Zd d Zd d ZddZdS)N) TestClient)appcCs0tt}|WdS1s"0YdS)N)rr)clientrL/home/cmiss/Jenkins/workspace/12-Labours-API/tests/test_api/test_gen3_api.pyrs rcCs"dddd}|jd|d}|S)Nzdummy_email@gmail.comdummy_machine_iddummy_expiration_time)emailmachine expirationz /access/token)json)postr )rZ dummy_dataresponserrrtoken s rcCs d}|jd|dd|did}|}|j}d}||k}|std|fd ||fd tvsnt|rxt|nd t|t|d }d d |i} t t | d}}}t |} d} | | k}|sbtd|fd| | fdtvstt rtt nddtvs$t|r.t|ndt| t| d} dd| i} t t | d} }} |dd}d}||k} | std| fd||ft|t|d}dd|i} t t | d}} }d}|jd|dd|did}|}|j}d}||k}|std|fd ||fd tvsRt|r\t|nd t|t|d }d d |i} t t | d}}}|d}d}||k} | std| fd||ft|t|d}dd|i} t t | d}} }dS) Nz$5b9ae1bd-e780-4869-a458-b3422084c480z/record/ AuthorizationBearer access_tokenheaders==z3%(py2)s {%(py2)s = %(py0)s.status_code } == %(py5)srpy0py2py5assert %(py7)spy7z0%(py3)s {%(py3)s = %(py0)s(%(py1)s) } == %(py6)slenresultrpy1py3py6assert %(py8)spy8record submitter_idz)dataset-217-version-2-dataset_descriptionz%(py1)s == %(py4)sr$py4assert %(py6)sr&z&5b9ae1bd-e780-4869-a458-fakeuuidsuffixdetailz0Data does not exist or unable to access the data getr status_code @pytest_ar_call_reprcompare @py_builtinslocals_should_repr_global_name _safereprAssertionError_format_explanationr!)rrUUIDrr" @py_assert1 @py_assert4 @py_assert3 @py_format6 @py_format8 @py_assert2 @py_assert5 @py_format7 @py_format9 @py_assert0 @py_format5rrrtest_get_gen3_records"prHcCs d}dd|gidd}|jd|dd|d id }|}|j}d }||k}|std |fd ||fdtvs|t|rt|ndt|t|d} dd| i} t t | d}}}|dd} | |k} | sDtd | fd| |ft| dtvst|r t|ndd} dd| i} t t | d} } |jd|dd|d id }|}|j}d }||k}|std |fd ||fdtvst|rt|ndt|t|d} dd| i} t t | d}}}|dd} | |k} | std | fd| |ft| dtvsRt|r\t|ndd} dd| i} t t | d} } |d} dgdgd}| |k} | std | fd| |ft| t|d}d d!|i}t t |d} } }|jd"|dd|d id }|}|j}d }||k}|std |fd ||fdtvsjt|rtt|ndt|t|d} dd| i} t t | d}}}|d}t |}d#}||k}|sJtd |fd$||fd%tvstt rtt nd%t|t|t|d&} d'd(| i}t t |d}}}}|d} dd)d*d+dd,d-d+g}| |k} | std | fd| |ft| t|d}d d!|i}t t |d} } }i}|jd|dd|d id }|}|j}d.}||k}|std |fd ||fdtvsJt|rTt|ndt|t|d} dd| i} t t | d}}}|d} d/}| |k} | std | fd| |ft| t|d}d d!|i}t t |d} } }d0d1i}|jd|dd|d id }|}|j}d.}||k}|std |fd ||fdtvstt|r~t|ndt|t|d} dd| i} t t | d}}}|d} d2}| |k} | std | fd| |ft| t|d}d d!|i}t t |d} } }dd|gid3d}|jd|dd|d id }|}|j}d4}||k}|std |fd ||fdtvst|rt|ndt|t|d} dd| i} t t | d}}}|d} d5}| |k} | sRtd | fd| |ft| t|d}d d!|i}t t |d} } }d6}dd||gidd}|jd|dd|d id }|}|j}d.}||k}| s td |fd ||fdtvst|rt|ndt|t|d} dd| i} t t | d}}}|d} d7}| |k} | std | fd| |ft| t|d}d d!|i}t t |d} } }dS)8Nzdataset-217-version-2experiment_queryr*)nodefiltersearchz/graphql/query?mode=datarrrr rrrrrrrrdata)z%(py1)s == %(py3)s DATASET_IDr$r%assert %(py5)srz/graphql/query?mode=detailr0facetZ BrainstemZScaffold)Anatomical structure Data typer+r,r.r&z/graphql/query?mode=facet)z0%(py4)s {%(py4)s = %(py0)s(%(py2)s) } == %(py7)sr!)rrr-rzassert %(py9)sZpy9rU manifest_filter>additional_types)rSterm facetPropPathrT-dataset_description_filter>study_organ_systemz!Missing field in the request bodyrKZfakenodezInvalid query node is usedz dummy contentiz'Search does not provide in current nodedataset-46-version-2zDMode detail only available when query one dataset in experiment node) r r r3r4r5r6r7r8r9r:r;r!)rrrPZ pass_caserr"r=r>r?r@rArFrB @py_format4rGrDZ @py_assert6rCZ @py_format10Z missing_dataZ wrong_nodeZinvalid_searchZ DATASET_ID2Z wrong_filterrrrtest_get_gen3_graphql_query/sv lll r^cCsdddgdgdgdgdi}|jd|d d |d id }|}|j}d }||k}|std|fd||fdtvst|rt|ndt|t|d}dd|i} t t | d}}}|ddd} d}| |k} | s4td| fd| |ft| t|d} dd| i} t t | d} } }|d} d}| |k} | std| fd| |ft| t|d} dd| i} t t | d} } }ddi}|jd |d d |d id }|}|j}d }||k}|s^td|fd||fdtvs t|r*t|ndt|t|d}dd|i} t t | d}}}|dd!d} d}| |k} | std| fd| |ft| t|d} dd| i} t t | d} } }i}|jd"|d d |d id }|}|j}d }||k}|std|fd||fdtvsNt|rXt|ndt|t|d}dd|i} t t | d}}}|ddd} d}| |k} | std| fd| |ft| t|d} dd| i} t t | d} } }|d} d}| |k} | sltd| fd| |ft| t|d} dd| i} t t | d} } }i}|jd#|d d |d id }|}|j}d$}||k}|s&td|fd||fdtvst|rt|ndt|t|d}dd|i} t t | d}}}|d%} d&}| |k} | std| fd| |ft| t|d} dd| i} t t | d} } }dd'd(gii}|jd|d d |d id }|}|j}d)}||k}|sVtd|fd||fdtvst|r"t|ndt|t|d}dd|i} t t | d}}}|d%} d*}| |k} | std| fd| |ft| t|d} dd| i} t t | d} } }dd+i}|jd|d d |d id }|}|j}d)}||k}|std|fd||fdtvsBt|rLt|ndt|t|d}dd|i} t t | d}}}|d%} |dd,}| |k} | std| fd| |ft| t|d} dd| i} t t | d} } }dS)-NrLZStomachz Vagus nerveZPlotZRatZMale)rZrWcase_filter>speciescase_filter>sexz/graphql/paginationrrrrNrrrrrrritemsr datasetIdr\r+r,r.r&totalrorderz Title(desc)z/graphql/pagination?search=z/graphql/pagination?search=ratsz/graphql/pagination?search=dogr/r0z+There is no matched content in the databaserWImager[z'Invalid or unauthorized facet passed inz Author(asc)z order option not provided) r r r3r4r5r6r7r8r9r:r;)rrZfilter_pass_caserr"r=r>r?r@rArFrBrGrDZorder_pass_caseZsearch_pass_caseZ wrong_searchZ wrong_facetZ wrong_orderrrr test_get_gen3_graphql_paginationstlttlllrgcCs|jddd|did}|}|j}d}||k}|std|fd||fd tvsdt|rnt|nd t|t|d }d d |i}t t |d}}}d } |d}| |v} | std| fd| |ft| t|d} dd| i} t t | d} } }d} |d}| |v} | sztd| fd| |ft| t|d} dd| i} t t | d} } }d} |d}| |v} | std| fd| |ft| t|d} dd| i} t t | d} } }d} |ddd}| |v} | sZtd| fd| |ft| t|d} dd| i} t t | d} } }d} |ddd}| |v} | std| fd| |ft| t|d} dd| i} t t | d} } }t |} d} | | k}|std|fd| | fdtvs"tt r,tt nddtvsHt|rRt|ndt| t| d} dd| i}t t |d} }} |jddd|did}|}|j}d}||k}|s:td|fd||fd tvst|rt|nd t|t|d }d d |i}t t |d}}}d} | |v} | std| fd | |ft| dtvst|rt|ndd!}d"d#|i}t t |d} } d$} | |v} | s:td| fd | |ft| dtvs t|rt|ndd!}d"d#|i}t t |d} } d%} | |v} | std| fd | |ft| dtvst|rt|ndd!}d"d#|i}t t |d} } d&} | |v} | s6td| fd | |ft| dtvst|rt|ndd!}d"d#|i}t t |d} } |d} d}| |k} | std| fd'| |ft| t|d} dd| i} t t | d} } }|d$} gd(}| |k} | std| fd'| |ft| t|d} dd| i} t t | d} } }|d%} gd)}| |k} | s~td| fd'| |ft| t|d} dd| i} t t | d} } }dS)*Nz/filter?sidebar=truerrrrrrrrrrrkeyr)in)z%(py1)s in %(py4)sr,r.r&labelchildrenrYr r!r"r#r'r(z/filter?sidebar=falsesize)z%(py1)s in %(py3)srQrRrtitlesz nodes>fieldselementsr+)rUz Age categoryz Access scopeZSexZSpeciesrT)rWzcase_filter>age_categoryzexperiment_filter>project_idr`r_rZr1)rrrr"r=r>r?r@rArFrBrGrDrCrEr]rrrtest_get_gen3_filters2llltt~~~~lprp)builtinsr6_pytest.assertion.rewrite assertionrewriter4pytestfastapi.testclientrapp.mainrfixturerrrHr^rgrprrrrs"    iK