forked from GithubBackups/healthchecks
Bump croniter version to 1.0.2
This commit is contained in:
parent
98b1e13aa1
commit
b9997137a6
@ -48,3 +48,8 @@ class CronPreviewTestCase(BaseTestCase):
|
||||
payload = {"schedule": "0 3 * * *", "tz": "Europe/Riga"}
|
||||
r = self.client.post("/checks/cron_preview/", payload)
|
||||
self.assertNotContains(r, "Invalid cron expression", status_code=200)
|
||||
|
||||
def test_it_handles_feb_29(self):
|
||||
payload = {"schedule": "0 0 29 2 *", "tz": "UTC"}
|
||||
r = self.client.post("/checks/cron_preview/", payload)
|
||||
self.assertContains(r, "Feb 29")
|
||||
|
@ -22,6 +22,10 @@ def validate(obj, schema, obj_name="value"):
|
||||
raise ValidationError("%s is too long" % obj_name)
|
||||
if schema.get("format") == "cron":
|
||||
try:
|
||||
# Does it have 5 components?
|
||||
if len(obj.split()) != 5:
|
||||
raise ValueError()
|
||||
|
||||
# Does croniter accept the schedule?
|
||||
it = croniter(obj)
|
||||
# Can it calculate the next datetime?
|
||||
|
@ -74,7 +74,7 @@ class JsonSchemaTestCase(TestCase):
|
||||
validate("baz", {"enum": ["foo", "bar"]})
|
||||
|
||||
def test_it_checks_cron_format(self):
|
||||
samples = ["x * * * *", "0 0 31 2 *"]
|
||||
samples = ["x * * * *", "0 0 31 2 *", "* * * * * *"]
|
||||
for sample in samples:
|
||||
with self.assertRaises(ValidationError):
|
||||
validate(sample, {"type": "string", "format": "cron"})
|
||||
|
@ -1,5 +1,5 @@
|
||||
cron-descriptor==1.2.24
|
||||
croniter==0.3.31
|
||||
croniter==1.0.2
|
||||
Django==3.1.5
|
||||
django-compressor==2.4
|
||||
fido2
|
||||
|
Loading…
x
Reference in New Issue
Block a user