Skip to content

Commit

Permalink
rdrf #2449 mocking vis config
Browse files Browse the repository at this point in the history
  • Loading branch information
id2359 committed Apr 12, 2023
1 parent 48f1856 commit f88fbf5
Showing 1 changed file with 42 additions and 4 deletions.
46 changes: 42 additions & 4 deletions rdrf/dashboards/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,40 @@ def create_traffic_light(self, data):

vis_config = Mock()

data = None
config_dict = {
"fields": [
"EORTCQLQC30_Q01",
"EORTCQLQC30_Q02",
"EORTCQLQC30_Q03",
"EORTCQLQC30_Q04",
"EORTCQLQC30_Q05",
"EORTCQLQC30_Q06",
"EORTCQLQC30_Q07",
"EORTCQLQC30_Q08",
"EORTCQLQC30_Q09",
"EORTCQLQC30_Q10",
"EORTCQLQC30_Q11",
"EORTCQLQC30_Q12",
"EORTCQLQC30_Q13",
"EORTCQLQC30_Q14",
"EORTCQLQC30_Q15",
"EORTCQLQC30_Q16",
"EORTCQLQC30_Q17",
"EORTCQLQC30_Q18",
"EORTCQLQC30_Q19",
"EORTCQLQC30_Q20",
"EORTCQLQC30_Q21",
"EORTCQLQC30_Q22",
"EORTCQLQC30_Q23",
"EORTCQLQC30_Q24",
"EORTCQLQC30_Q25",
"EORTCQLQC30_Q26",
"EORTCQLQC30_Q27",
"EORTCQLQC30_Q28",
]
}

vis_config.config = config_dict
patient = Mock()

return TrafficLights("crc test tl", vis_config, data, patient, None)
Expand All @@ -75,11 +108,16 @@ def check_baseline(self, df):
self.assertEqual(row["SEQ"], 0, "baseline row does not have SEQ 0")
num_baselines += 1

self.assertEqual(num_baselines, 1, f"Number of baseline rows is not 1: is {num_baselines}")

self.assertEqual(
num_baselines, 1, f"Number of baseline rows is not 1: is {num_baselines}"
)

def check_followups(self, df):
for index, row in df.iterrows():
if row["TYPE"] == "followup":
seq = row["SEQ"]
self.assertGreater(seq, 0, f"followup seq number should be greater than 0. Actual={seq}")
self.assertGreater(
seq,
0,
f"followup seq number should be greater than 0. Actual={seq}",
)

0 comments on commit f88fbf5

Please sign in to comment.