fix(domain): validate report calendar dates
This commit is contained in:
1 parent
7f16c12255
commit
1455b8cfbf
3 files changed
+22
-1
No files matched your search
@@ -11,6 +11,7 @@ from app.belki.domain import (
|
||||
calculate_training,
|
||||
format_clock,
|
||||
parse_clock,
|
||||
parse_report_date,
|
||||
)
|
||||
from app.belki.reports import render_coaching, render_inspection, render_training
|
||||
|
||||
@@ -28,6 +29,12 @@ class ClockTests(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
parse_clock("5:5")
|
||||
|
||||
def test_report_date_requires_a_real_calendar_day(self):
|
||||
self.assertEqual(parse_report_date("29.02"), (29, 2))
|
||||
for value in ("31.02", "32.01", "15/08", "today"):
|
||||
with self.subTest(value=value), self.assertRaises(ValueError):
|
||||
parse_report_date(value)
|
||||
|
||||
|
||||
class CalculationTests(unittest.TestCase):
|
||||
def test_goal_rejects_non_finite_and_unbounded_input(self):
|
||||
|
||||
Reference in new issue
Block a user