Add output-path tests (#1518)

This commit is contained in:
matt bowen 2022-08-02 10:59:18 -04:00
parent 4e39be6748
commit 415af5b31e
3 changed files with 23 additions and 3 deletions

View file

@ -56,3 +56,14 @@ class TestChildOpportunityIndexETL(TestETL):
assert etl.HEALTHY_FOOD_INPUT_FIELD == "HE_FOOD"
assert etl.IMPENETRABLE_SURFACES_INPUT_FIELD == "HE_GREEN"
assert etl.READING_INPUT_FIELD == "ED_READING"
def test_get_output_file_path(self, mock_etl, mock_paths):
"""Tests the right file name is returned."""
etl = self._ETL_CLASS()
data_path, tmp_path = mock_paths
output_file_path = etl._get_output_file_path()
expected_output_file_path = (
data_path / "dataset" / "child_opportunity_index" / "usa.csv"
)
assert output_file_path == expected_output_file_path

View file

@ -15,7 +15,7 @@ class TestDOEEnergyBurdenETL(TestETL):
This uses pytest-snapshot.
To update individual snapshots: $ poetry run pytest
data_pipeline/tests/sources/ndoe_energy_burden/test_etl.py::TestClassNameETL::<testname>
data_pipeline/tests/sources/doe_energy_burden/test_etl.py::TestClassNameETL::<testname>
--snapshot-update
"""
@ -48,3 +48,14 @@ class TestDOEEnergyBurdenETL(TestETL):
assert etl.INPUT_GEOID_TRACT_FIELD_NAME == "FIP"
assert etl.INPUT_ENERGY_BURDEN_FIELD_NAME == "BURDEN"
assert etl.REVISED_ENERGY_BURDEN_FIELD_NAME == "Energy burden"
def test_get_output_file_path(self, mock_etl, mock_paths):
"""Tests the right file name is returned."""
etl = self._ETL_CLASS()
data_path, tmp_path = mock_paths
output_file_path = etl._get_output_file_path()
expected_output_file_path = (
data_path / "dataset" / "doe_energy_burden" / "usa.csv"
)
assert output_file_path == expected_output_file_path

View file

@ -1,7 +1,5 @@
# pylint: disable=protected-access
from unittest import mock
import pathlib
import requests
from data_pipeline.etl.base import ValidGeoLevel
from data_pipeline.etl.sources.national_risk_index.etl import (