fix: validate cron expression before writing to crontab
This commit is contained in:
@@ -66,3 +66,9 @@ def test_delete_alarm(crontab_file):
|
||||
|
||||
manager.delete_alarm(alarm_id)
|
||||
assert len(manager.get_alarms()) == 0
|
||||
|
||||
|
||||
def test_set_alarm_rejects_invalid_cron_expression(crontab_file):
|
||||
manager = CrontabManager(tabfile=crontab_file)
|
||||
with pytest.raises(ValueError, match="Invalid cron expression"):
|
||||
manager.set_alarm("test-id", "not-a-cron-expression", "cmd", True)
|
||||
|
||||
Reference in New Issue
Block a user