Skip to content

Commit

Permalink
Update unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
rosswhitfield committed Sep 19, 2024
1 parent 963290f commit e1a7d05
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/webmon_app/reporting/tests/test_report/test_view_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def setUpTestData(cls):
def tearDownClass(cls):
Instrument.objects.get(name="test_instrument").delete()
IPTS.objects.get(expt_name="test_exp").delete()
StatusQueue.objects.get(name="test").delete()
StatusQueue.objects.all().delete()
DataRun.objects.all().delete()
WorkflowSummary.objects.all().delete()

Expand Down Expand Up @@ -221,7 +221,7 @@ def test_get_run_status_text(self):
self.assertTrue("run_id_" in rst)
# no show element id, green status
rst = get_run_status_text(run_id)
self.assertTrue("green" in rst)
self.assertTrue("acquiring" in rst)
# no show element, red status
ipts = IPTS.objects.get(expt_name="test_exp")
run = DataRun.objects.create(
Expand All @@ -231,12 +231,26 @@ def test_get_run_status_text(self):
file="/tmp/test_65535.nxs",
)
run.save()
WorkflowSummary.objects.create(
workflowSummary = WorkflowSummary.objects.create(
run_id=run,
complete=False,
).save()
)
workflowSummary.save()

rst = get_run_status_text(run)
self.assertTrue("acquiring" in rst)
dataReady = StatusQueue(name="POSTPROCESS.DATA_READY", is_workflow_input=True)
dataReady.save()
RunStatus.objects.create(run_id=run, queue_id=dataReady).save()
rst = get_run_status_text(run)
self.assertTrue("red" in rst)
self.assertTrue("incomplete" in rst)

workflowSummary.complete = True
workflowSummary.save()
rst = get_run_status_text(run)
self.assertTrue("green" in rst)
self.assertTrue("complete" in rst)

def test_get_run_list_dict(self):
from reporting.report.view_util import get_run_list_dict
Expand Down

0 comments on commit e1a7d05

Please sign in to comment.