Skip to content

Commit

Permalink
Update setup and add docstring to test functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Milo Hyben committed Aug 23, 2023
1 parent 6ffd592 commit 0984975
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions metamist_infrastructure/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@
packages=[
'metamist_infrastructure',
'metamist_infrastructure.etl',
'metamist_infrastructure.etl.post',
'metamist_infrastructure.etl.extract',
'metamist_infrastructure.etl.load',
],
package_dir={
# files in THIS directory are included as metamist_infrastructure
'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'],
},
Expand Down
8 changes: 4 additions & 4 deletions test/test_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
"""
Expand All @@ -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 = ''
Expand All @@ -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"}')

Expand All @@ -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"}')

Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 0984975

Please sign in to comment.