From 25b0b3f224672406e7c524e4d9f72fe357aa78a4 Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Fri, 12 Jul 2024 09:13:10 -0400 Subject: [PATCH] fix returning status for PEPhub backend --- pipestat/backends/pephub_backend/pephubbackend.py | 2 ++ tests/test_pipestat.py | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pipestat/backends/pephub_backend/pephubbackend.py b/pipestat/backends/pephub_backend/pephubbackend.py index 7d25a27a..513f7a01 100644 --- a/pipestat/backends/pephub_backend/pephubbackend.py +++ b/pipestat/backends/pephub_backend/pephubbackend.py @@ -341,6 +341,8 @@ def get_status(self, record_identifier: str) -> Optional[str]: except IndexError or KeyError: status = None + if status == "": # PEPhub returns '' for empty cell + status = None return status def select_records( diff --git a/tests/test_pipestat.py b/tests/test_pipestat.py index 79bea636..225f4802 100644 --- a/tests/test_pipestat.py +++ b/tests/test_pipestat.py @@ -2607,7 +2607,7 @@ def test_pephub_backend_retrieve_many( assert len(results["records"]) == 2 - def test_get_status_pephub_backend( + def test_set_status_pephub_backend( self, config_file_path, schema_file_path, @@ -2618,25 +2618,29 @@ def test_get_status_pephub_backend( psm = PipestatManager(pephub_path=PEPHUB_URL, schema_path=schema_file_path) - result = psm.get_status(record_identifier=rec_ids[0]) + result = psm.set_status(record_identifier=rec_ids[0], status_identifier="completed") assert result is None - def test_set_status_pephub_backend( + def test_get_status_pephub_backend( self, config_file_path, schema_file_path, results_file_path, range_values, ): - rec_ids = ["test_pipestat_01"] + rec_ids = ["sample1", "test_pipestat_01"] psm = PipestatManager(pephub_path=PEPHUB_URL, schema_path=schema_file_path) - result = psm.set_status(record_identifier=rec_ids[0], status_identifier="completed") + result = psm.get_status(record_identifier=rec_ids[0]) assert result is None + result = psm.get_status(record_identifier=rec_ids[1]) + + assert result == "completed" + def test_pephub_backend_remove( self, config_file_path,