Skip to content

Commit

Permalink
Merge pull request #32 from aanil/fix_git
Browse files Browse the repository at this point in the history
Add some test conditions
  • Loading branch information
aanil authored Jan 18, 2024
2 parents e4f0ded + f40b7cb commit 2ffd5c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 4 additions & 2 deletions tests/test_ngi_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,14 @@ def test_save_data_to_disk(data_repo_full, mocked_statusdb_conn_rows):
def test_get_data_with_project(data_repo_full, mocked_statusdb_conn_rows):
"""Test getting data for a specific order"""
config_values = config.Config()
order_id = "NGI123457"
with mock.patch("daily_read.statusdb.StatusDBSession"):
data_master = ngi_data.ProjectDataMaster(config_values)
data_master.sources[0].statusdb_session.rows.return_value = mocked_statusdb_conn_rows
data_master.get_data("NGI123457")
data_master.get_data(order_id)
assert len(data_master.data.keys()) == 1
assert "NGI123457" in data_master.data
assert order_id in data_master.data
assert data_master.data[order_id].internal_id_or_portal_id == "P123457"


def test_get_data_with_project_unknown(data_repo_full, mocked_statusdb_conn_rows):
Expand Down
7 changes: 3 additions & 4 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

from daily_read import utils

daily_read_module_name = "tests"
log = logging.getLogger(daily_read_module_name)


def test_error_reporting_without_error():
"""Test that no error is raised when the log has no error messages"""
daily_read_module_name = "tests"
log = logging.getLogger(daily_read_module_name)
log.info("Test info")
log.warning("Warn message")
try:
Expand All @@ -18,8 +19,6 @@ def test_error_reporting_without_error():

def test_error_reporting_with_error():
"""Test error thrown when the log has error messages"""
daily_read_module_name = "tests"
log = logging.getLogger(daily_read_module_name)
log.error("Test error message")
with pytest.raises(RuntimeError, match=f"Errors logged in {daily_read_module_name} during execution"):
utils.error_reporting(log, "tests")

0 comments on commit 2ffd5c2

Please sign in to comment.