Skip to content

Commit

Permalink
add hardcoded object headers fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
glass-ships committed Jan 8, 2024
1 parent 4f94bce commit c9871f1
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 119 deletions.
123 changes: 123 additions & 0 deletions backend/tests/fixtures/object_headers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import pytest


@pytest.fixture
def node_headers():
return [
"id",
"category",
"name",
"full_name",
"deprecated",
"description",
"xref",
"provided_by",
"in_taxon",
"in_taxon_label",
"symbol",
"synonym",
"uri",
"inheritance",
"causal_gene",
"causes_disease",
"mappings",
"external_links",
"provided_by_link",
"association_counts",
"node_hierarchy",
]


@pytest.fixture
def search_headers():
return [
"id",
"category",
"name",
"full_name",
"deprecated",
"description",
"xref",
"provided_by",
"in_taxon",
"in_taxon_label",
"symbol",
"synonym",
"uri",
"highlight",
"score",
]


@pytest.fixture
def histopheno_headers():
return ["label", "count", "id"]


@pytest.fixture
def association_headers():
return [
"id",
"category",
"subject",
"original_subject",
"subject_namespace",
"subject_category",
"subject_closure",
"subject_label",
"subject_closure_label",
"subject_taxon",
"subject_taxon_label",
"predicate",
"object",
"original_object",
"object_namespace",
"object_category",
"object_closure",
"object_label",
"object_closure_label",
"object_taxon",
"object_taxon_label",
"primary_knowledge_source",
"aggregator_knowledge_source",
"negated",
"pathway",
"evidence_count",
"has_evidence",
"has_evidence_links",
"grouping_key",
"provided_by",
"provided_by_link",
"publications",
"publications_links",
"qualifiers",
"frequency_qualifier",
"onset_qualifier",
"sex_qualifier",
"stage_qualifier",
"qualifiers_label",
"qualifiers_namespace",
"qualifiers_category",
"qualifiers_closure",
"qualifiers_closure_label",
"frequency_qualifier_label",
"frequency_qualifier_namespace",
"frequency_qualifier_category",
"frequency_qualifier_closure",
"frequency_qualifier_closure_label",
"onset_qualifier_label",
"onset_qualifier_namespace",
"onset_qualifier_category",
"onset_qualifier_closure",
"onset_qualifier_closure_label",
"sex_qualifier_label",
"sex_qualifier_namespace",
"sex_qualifier_category",
"sex_qualifier_closure",
"sex_qualifier_closure_label",
"stage_qualifier_label",
"stage_qualifier_namespace",
"stage_qualifier_category",
"stage_qualifier_closure",
"stage_qualifier_closure_label",
]
124 changes: 5 additions & 119 deletions backend/tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,124 +96,10 @@ def test_get_provided_by_link():
@pytest.mark.parametrize(
"obj, expected",
[
(
"node",
[
"id",
"category",
"name",
"full_name",
"deprecated",
"description",
"xref",
"provided_by",
"in_taxon",
"in_taxon_label",
"symbol",
"synonym",
"uri",
"inheritance",
"causal_gene",
"causes_disease",
"mappings",
"external_links",
"provided_by_link",
"association_counts",
"node_hierarchy",
],
),
(
"search",
[
"id",
"category",
"name",
"full_name",
"deprecated",
"description",
"xref",
"provided_by",
"in_taxon",
"in_taxon_label",
"symbol",
"synonym",
"uri",
"highlight",
"score",
],
),
(
"histopheno",
["label", "count", "id"],
),
(
"associations",
[
"id",
"category",
"subject",
"original_subject",
"subject_namespace",
"subject_category",
"subject_closure",
"subject_label",
"subject_closure_label",
"subject_taxon",
"subject_taxon_label",
"predicate",
"object",
"original_object",
"object_namespace",
"object_category",
"object_closure",
"object_label",
"object_closure_label",
"object_taxon",
"object_taxon_label",
"primary_knowledge_source",
"aggregator_knowledge_source",
"negated",
"pathway",
"evidence_count",
"has_evidence",
"has_evidence_links",
"grouping_key",
"provided_by",
"provided_by_link",
"publications",
"publications_links",
"qualifiers",
"frequency_qualifier",
"onset_qualifier",
"sex_qualifier",
"stage_qualifier",
"qualifiers_label",
"qualifiers_namespace",
"qualifiers_category",
"qualifiers_closure",
"qualifiers_closure_label",
"frequency_qualifier_label",
"frequency_qualifier_namespace",
"frequency_qualifier_category",
"frequency_qualifier_closure",
"frequency_qualifier_closure_label",
"onset_qualifier_label",
"onset_qualifier_namespace",
"onset_qualifier_category",
"onset_qualifier_closure",
"onset_qualifier_closure_label",
"sex_qualifier_label",
"sex_qualifier_namespace",
"sex_qualifier_category",
"sex_qualifier_closure",
"sex_qualifier_closure_label",
"stage_qualifier_label",
"stage_qualifier_namespace",
"stage_qualifier_category",
"stage_qualifier_closure",
"stage_qualifier_closure_label",
],
),
("node", "node_headers"),
("search", "search_headers"),
("histopheno", "histopheno_headers"),
("associations", "association_headers"),
],
)
def test_get_headers_from_obj(obj, expected, request):
Expand All @@ -230,6 +116,6 @@ def test_get_headers_from_obj(obj, expected, request):
associations = request.getfixturevalue(obj)
obj = AssociationResults(**associations)

expected = request.getfixturevalue(expected)
headers = get_headers_from_obj(obj)
print(headers)
assert headers == expected

0 comments on commit c9871f1

Please sign in to comment.