From 0984975501943442a069312803db13aa5f39235e Mon Sep 17 00:00:00 2001 From: Milo Hyben Date: Wed, 23 Aug 2023 15:58:13 +1000 Subject: [PATCH] Update setup and add docstring to test functions. --- metamist_infrastructure/setup.py | 10 +++++----- test/test_etl.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/metamist_infrastructure/setup.py b/metamist_infrastructure/setup.py index b43fca9ca..116e27860 100644 --- a/metamist_infrastructure/setup.py +++ b/metamist_infrastructure/setup.py @@ -24,7 +24,7 @@ packages=[ 'metamist_infrastructure', 'metamist_infrastructure.etl', - 'metamist_infrastructure.etl.post', + 'metamist_infrastructure.etl.extract', 'metamist_infrastructure.etl.load', ], package_dir={ @@ -32,16 +32,16 @@ 'metamist_infrastructure': '.', # files in ../etl are included as metamist_infrastructure.etl 'metamist_infrastructure.etl': '../etl', - # files in ../etl/post are included as metamist_infrastructure.etl.post - 'metamist_infrastructure.etl.post': '../etl/post', + # files in ../etl/extract are included as metamist_infrastructure.etl.extract + 'metamist_infrastructure.etl.extract': '../etl/extract', # files in ../etl/load are included as metamist_infrastructure.etl.load 'metamist_infrastructure.etl.load': '../etl/load', }, package_data={ # ensure bq_schema.json is included in etl 'metamist_infrastructure.etl': ['*.json'], - # ensure requirements.txt is included in etl.post - 'metamist_infrastructure.etl.post': ['*.txt'], + # ensure requirements.txt is included in etl.extract + 'metamist_infrastructure.etl.extract': ['*.txt'], # ensure requirements.txt is included in etl.load 'metamist_infrastructure.etl.load': ['*.txt'], }, diff --git a/test/test_etl.py b/test/test_etl.py index 4a61811ac..c74cf01a1 100644 --- a/test/test_etl.py +++ b/test/test_etl.py @@ -5,10 +5,6 @@ import etl.extract.main import etl.load.main -"""" execute only this test -python -m unittest discover -s test -k test_etl -""" - ETL_SAMPLE_RECORD = """ {"identifier": "AB0002", "name": "j smith", "age": 50, "measurement": "98.7", "observation": "B++", "receipt_date": "1/02/2023"} """ @@ -24,6 +20,7 @@ class TestEtl(unittest.TestCase): def test_etl_extract_valid_payload( self, pubsub_client, bq_client, uuid4_fun, email_from_id_token_fun ): + """Test etl extract valid payload""" request = MagicMock(args={}, spec=['__len__', 'toJSON', 'authorization']) request.json = json.loads(ETL_SAMPLE_RECORD) request.path = '' @@ -45,6 +42,7 @@ def test_etl_extract_valid_payload( def test_etl_load_not_found_record( self, bq_client ): + """Test etl load not found""" request = MagicMock(args={}, spec=['__len__', 'toJSON', 'authorization', 'get_json']) request.get_json.return_value = json.loads('{"request_id": "1234567890"}') @@ -64,6 +62,7 @@ def test_etl_load_not_found_record( def test_etl_load_found_record_simple_payload( self, bq_client ): + """Test etl load simple payload""" request = MagicMock(args={}, spec=['__len__', 'toJSON', 'authorization', 'get_json']) request.get_json.return_value = json.loads('{"request_id": "1234567890"}') @@ -92,6 +91,7 @@ def test_etl_load_found_record_simple_payload( def test_etl_load_found_record_pubsub_payload( self, bq_client ): + """Test etl load pubsub payload""" request = MagicMock(args={}, spec=['__len__', 'toJSON', 'authorization', 'get_json']) pubsub_payload_example = {