From 92eb8e9cb9d57f30eecb5249c6ef6bd8bc979643 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Thu, 17 Feb 2022 11:48:31 -0500 Subject: [PATCH] test for date field validation --- .../data/date_validation/date_validation.bpmn | 89 +++++++++++++++++++ .../test_workflow_date_field_validation.py | 12 +++ 2 files changed, 101 insertions(+) create mode 100644 tests/data/date_validation/date_validation.bpmn create mode 100644 tests/workflow/test_workflow_date_field_validation.py diff --git a/tests/data/date_validation/date_validation.bpmn b/tests/data/date_validation/date_validation.bpmn new file mode 100644 index 00000000..42e6d532 --- /dev/null +++ b/tests/data/date_validation/date_validation.bpmn @@ -0,0 +1,89 @@ + + + + + Flow_09e6w2a + + + + + + Flow_19hbirj + + + + + + + + + + + + + Flow_09e6w2a + Flow_0cbbsi7 + + + Flow_0cbbsi7 + Flow_0dvxkh6 + delta1 = timedelta(hours=2) +format = '%Y-%m-%dT%H:%M:%S.%fZ' +the_date = datetime.datetime.strptime(a_date, format) +modified_date = the_date + delta1 +del(delta1) + + + # Dates + + +## A Date +{{ a_date }} + + +## A Delta +{{ a_delta }} + + +## Modified Date +{{ modified_date }} + Flow_0dvxkh6 + Flow_19hbirj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/workflow/test_workflow_date_field_validation.py b/tests/workflow/test_workflow_date_field_validation.py new file mode 100644 index 00000000..8f468cd6 --- /dev/null +++ b/tests/workflow/test_workflow_date_field_validation.py @@ -0,0 +1,12 @@ +from tests.base_test import BaseTest + + +class TestDateValidation(BaseTest): + + def test_date_validation(self): + + """We were not instantiating date fields correctly during validation. + This is a simple test to make sure we seed an actual date in date fields instead of a random string.""" + spec_model = self.load_test_spec('date_validation') + rv = self.app.get('/v1.0/workflow-specification/%s/validate' % spec_model.id, headers=self.logged_in_headers()) + self.assertEqual([], rv.json)