Skip to content
Snippets Groups Projects
Commit 426cf3ce authored by Mario Raciti's avatar Mario Raciti
Browse files

TMSS-672: Add more tests for the 'at' constraint

parent 6cb0ae3e
No related branches found
No related tags found
1 merge request!394Resolve TMSS-672
...@@ -1103,7 +1103,7 @@ class TestTimeConstraints(TestCase): ...@@ -1103,7 +1103,7 @@ class TestTimeConstraints(TestCase):
def test_can_run_within_at_constraint(self): def test_can_run_within_at_constraint(self):
""" """
Test "at" constraint Test "at" constraint with both boundary and 'inside' upper_bound and lower_bound
""" """
# no constraints defined so should be OK # no constraints defined so should be OK
self.clear_time_constraints() self.clear_time_constraints()
...@@ -1123,13 +1123,35 @@ class TestTimeConstraints(TestCase): ...@@ -1123,13 +1123,35 @@ class TestTimeConstraints(TestCase):
datetime(2020, 1, 1, 12, 0, 0), datetime(2020, 1, 1, 12, 0, 0),
datetime(2020, 1, 1, 14, 0, 0))) datetime(2020, 1, 1, 14, 0, 0)))
# Set datetime constraint at upper_bound
self.clear_time_constraints()
self.add_time_at_constraint(datetime(2020, 1, 1, 14, 0, 0))
self.assertFalse(tc1.can_run_within_timewindow_with_time_constraints(self.scheduling_unit_blueprint,
datetime(2020, 1, 1, 12, 0, 0),
datetime(2020, 1, 1, 14, 0, 0)))
# Set datetime constraint after upper_bound # Set datetime constraint after upper_bound
self.clear_time_constraints() self.clear_time_constraints()
self.add_time_at_constraint(datetime(2020, 1, 2, 15, 0, 0)) self.add_time_at_constraint(datetime(2020, 1, 1, 15, 0, 0))
self.assertFalse(tc1.can_run_within_timewindow_with_time_constraints(self.scheduling_unit_blueprint, self.assertFalse(tc1.can_run_within_timewindow_with_time_constraints(self.scheduling_unit_blueprint,
datetime(2020, 1, 1, 12, 0, 0), datetime(2020, 1, 1, 12, 0, 0),
datetime(2020, 1, 1, 14, 0, 0))) datetime(2020, 1, 1, 14, 0, 0)))
# Set datetime constraint at lower_bound
self.clear_time_constraints()
self.add_time_at_constraint(datetime(2020, 1, 1, 12, 0, 0))
self.assertTrue(self.execute_can_run_within_timewindow_with_time_constraints_of_24hour_boundary())
# Set datetime constraint that fits the time window
self.clear_time_constraints()
self.add_time_at_constraint(datetime(2020, 1, 1, 18, 30, 0))
self.assertTrue(self.execute_can_run_within_timewindow_with_time_constraints_of_24hour_boundary())
# Set datetime constraint so that obs lasts till exactly upper_bound
self.clear_time_constraints()
self.add_time_at_constraint(datetime(2020, 1, 2, 9, 50, 0))
self.assertTrue(self.execute_can_run_within_timewindow_with_time_constraints_of_24hour_boundary())
def test_can_run_within_between_constraints(self): def test_can_run_within_between_constraints(self):
""" """
Test multiple 'between' constraints within 24 boundary and check overall result of Test multiple 'between' constraints within 24 boundary and check overall result of
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment