File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,9 +83,11 @@ async def get_ensembl_summary_helper(
8383
8484 uniprot_accession = mapping ["uniprotEntry" ]["uniprotAccession" ]
8585 uniprot_set .add (uniprot_accession )
86-
8786 mapping ["ensemblTranscript" ].update (
88- {"alignment_difference" : mapping ["alignment_difference" ]}
87+ {
88+ "alignment_difference" : mapping ["alignment_difference" ],
89+ "transcript_id" : str (mapping ["ensemblTranscript" ]["transcript_id" ]),
90+ }
8991 )
9092
9193 if not transcript_dict .get (uniprot_accession ):
Original file line number Diff line number Diff line change @@ -65,18 +65,30 @@ async def test_get_ensembl_summaries_api(
6565 "app.ensembl.ensembl.get_ensembl_mappings" , return_value = valid_gifts_response
6666 )
6767
68- uniprot_list_future = asyncio .Future ()
69- uniprot_list_future .set_result (uniprot_summary_obj_list )
7068 mocker .patch (
7169 "app.ensembl.ensembl.get_list_of_uniprot_summary_helper" ,
72- return_value = uniprot_list_future ,
70+ return_value = uniprot_summary_obj_list ,
71+ )
72+ mocker .patch (
73+ "app.ensembl.ensembl.get_uniprot_api_results" ,
74+ return_value = {},
75+ )
76+ mocker .patch (
77+ "app.ensembl.ensembl.get_uniprot_name" ,
78+ return_value = "Test protein" ,
7379 )
7480
7581 response = await client .get (
7682 "/ensembl/summary/ENSG00000288864.json" ,
7783 )
7884
7985 assert response .status_code == status .HTTP_200_OK
86+ response_json = response .json ()
87+ assert response_json ["uniprot_mappings" ]
88+ assert all (
89+ isinstance (mapping ["ensembl_transcript" ]["transcript_id" ], str )
90+ for mapping in response_json ["uniprot_mappings" ]
91+ )
8092
8193
8294@pytest .mark .asyncio
You can’t perform that action at this time.
0 commit comments