Repository: cancervariants/therapy-normalization (language: python)

Issue:
Add test for DiseaseIndicationBase
Sadly forgot updating `_normalize_disease` in `DiseaseIndicationBase` with the latest changes from disease normalizer  😭  We should add a test only for CI so that we can ensure that current version of disease-normalizer works 


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml
index 19404853..3d2a934c 100644
--- a/.github/workflows/checks.yaml
+++ b/.github/workflows/checks.yaml
@@ -9,6 +9,7 @@ jobs:
             AWS_SECRET_ACCESS_KEY: ${{ secrets.DUMMY_AWS_SECRET_ACCESS_KEY }}
             AWS_DEFAULT_REGION: us-east-2
             AWS_DEFAULT_OUTPUT: text
+            DISEASE_NORM_DB_URL: http://localhost:8002
             THERAPY_NORM_DB_URL: http://localhost:8002
             THERAPY_TEST: true
         strategy:


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
index aa668ed8..8efbb2f5 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -30,6 +30,7 @@ def pytest_collection_modifyitems(items):
         "test_database",
         "test_query",
         "test_emit_warnings",
+        "test_disease_indication"
     ]
     items.sort(key=lambda i: MODULE_ORDER.index(i.module.__name__))
 
diff --git a/tests/scripts/build_disease_normalizer_data.py b/tests/scripts/build_disease_normalizer_data.py
index fa6ce644..2d605b91 100644
--- a/tests/scripts/build_disease_normalizer_data.py
+++ b/tests/scripts/build_disease_normalizer_data.py
@@ -61,5 +61,5 @@ def normalize(self, query: str) -> DiseaseNormalizationService:
 h.perform_etl(use_existing=True)
 
 
-with open(TEST_DATA_DIRECTORY / "disease_normalization_testTODO.json", "w") as f:
+with open(TEST_DATA_DIRECTORY / "disease_normalization.json", "w") as f:
     json.dump(disease_normalizer_table, f)
diff --git a/tests/unit/test_disease_indication.py b/tests/unit/test_disease_indication.py
new file mode 100644
index 00000000..86231c6c
--- /dev/null
+++ b/tests/unit/test_disease_indication.py
@@ -0,0 +1,80 @@
+"""Module for testing DiseaseIndicationBase. This is needed so we know if
+disease-normalizer introduced breaking changes.
+"""
+import os
+
+from disease.database import AWS_ENV_VAR_NAME
+from disease.query import QueryHandler as DiseaseQueryHandler
+
+from therapy.etl.base import DiseaseIndicationBase
+
+
+RUN_TEST = os.environ.get("THERAPY_TEST", "").lower() == "true" and AWS_ENV_VAR_NAME not in os.environ  # noqa: E501
+
+
+class TestDiseaseIndication(DiseaseIndicationBase):
+    """Test instance for DiseaseIndicationBase"""
+
+    def __init__(self):
+        """Initialize test TestDiseaseIndication"""
+        self.disease_normalizer = DiseaseQueryHandler()
+
+        if RUN_TEST:
+            self.load_disease_test_data()
+
+    def load_disease_test_data(self):
+        """Load disease data"""
+        disease = {
+            "label_and_type": "mondo:0700110##identity",
+            "item_type": "identity",
+            "src_name": "Mondo",
+            "concept_id": "mondo:0700110",
+            "label": "pneumonia, non-human animal",
+            "merge_ref": "mondo:07001110##merger"
+        }
+        self.disease_normalizer.db.diseases.put_item(Item=disease)
+
+        merge = {
+            "label_and_type": "mondo:0700110##merger",
+            "item_type": "merger",
+            "src_name": "Mondo",
+            "concept_id": "mondo:0700110",
+            "label": "pneumonia, non-human animal",
+        }
+        self.disease_normalizer.db.diseases.put_item(Item=merge)
+
+        source = {
+            "src_name": "Mondo",
+            "data_license": "CC BY 4.0",
+            "data_license_url": "https://creativecommons.org/licenses/by/4.0/legalcode",
+            "version": "2022-10-11",
+            "data_license_attributes": {
+                "non_commercial": False,
+                "share_alike": False,
+                "attribution": True
+            }
+        }
+        self.disease_normalizer.db.metadata.put_item(Item=source)
+
+    def _download_data():
+        """Implement abstract method"""
+        pass
+
+    def _http_download():
+        """Implement abstract method"""
+        pass
+
+    def _transform_data():
+        """Implement abstract method"""
+        pass
+
+    def _load_meta():
+        """Implement abstract method"""
+        pass
+
+
+def test_normalize_disease():
+    """Test that DiseaseIndicationBase works correctly when normalizing diseases"""
+    dib = TestDiseaseIndication()
+    norm_disease = dib._normalize_disease("mondo:0700110")
+    assert norm_disease == "mondo:0700110"