Commit 15a197bb authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add consistency tests to E2E contribution interface

parent 1827f588
......@@ -39,12 +39,10 @@ def compute_ppi_name(entry_data):
if item["complex_type"] == "Partner"
]
bound_protein_names = [
get_uniprot_info(uniprot_id)["short_name"]
for uniprot_id in bound_uniprots
get_uniprot_info(uniprot_id)["short_name"] for uniprot_id in bound_uniprots
]
partner_protein_names = [
get_uniprot_info(uniprot_id)["short_name"]
for uniprot_id in partner_uniprots
get_uniprot_info(uniprot_id)["short_name"] for uniprot_id in partner_uniprots
]
bound_protein_names.sort()
partner_protein_names.sort()
......@@ -563,10 +561,32 @@ class ContributionE2ETestCase(TestCase):
bibliography = models.Bibliography.objects.get(
id_source=entry_data["id_source"].strip()
)
for activity_tests in entry_data["activity_tests"]:
for compound_activity_results in activity_tests[
"compound_activity_results"
]:
for activity_test in entry_data["activity_tests"]:
tad_filters = {
"test_type": activity_test["test_type"],
"test_name": activity_test["test_name"],
"protein_bound_construct": activity_test["protein_bound_construct"],
"test_modulation_type": activity_test["test_modulation_type"],
"nb_active_compounds": activity_test["nb_active_compounds"],
}
if (
"cell_line_name" in activity_test
and activity_test["cell_line_name"] != ""
):
tad_filters["cell_line__name"] = activity_test["cell_line_name"]
for tad in models.TestActivityDescription.objects.all():
print(
tad.test_type,
tad.test_name,
tad.protein_bound_construct,
tad.test_modulation_type,
tad.nb_active_compounds,
tad.cell_line,
)
test_activity_description = models.TestActivityDescription.objects.get(
**tad_filters
)
for compound_activity_results in activity_test["compound_activity_results"]:
compound = models.RefCompoundBiblio.objects.get(
bibliography=bibliography,
compound_name=compound_activity_results["compound_name"],
......@@ -575,6 +595,14 @@ class ContributionE2ETestCase(TestCase):
activity_type=compound_activity_results["activity_type"],
modulation_type=compound_activity_results["modulation_type"],
compound=compound,
test_activity_description=test_activity_description,
)
self.assertEqual(
results.activity_type, compound_activity_results["activity_type"]
)
self.assertEqual(
results.modulation_type,
compound_activity_results["modulation_type"],
)
self.assertEqual(
Decimal(compound_activity_results["activity"]).quantize(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment