def test_run_get_runs_for_day(self): """ This method tests the ability of the runs table to retrieve every run set to be played on a given day. The expected result should be for a the call to result an empty dictionary. """ # Give the method a future date and receive correct no. of time-slots for that date date = datetime.date.today() + datetime.timedelta(days=1) dayRuns = Run.get_runs_for_day(date) # Test that the method returns the right information assert dayRuns == []
def test_run_get_runs_for_day_with_runs(self): """ This method tests the ability of the runs table to retrieve every run set to be played on a given day. The expected result should be for the call to result in the same number of runs as previously added. """ dt = datetime.datetime.now() + datetime.timedelta(days=1) dt = dt.replace(minute=0, second=0, microsecond=0) runs = [ Run(create_input_pattern(), dt, self._insert_name), Run(create_input_pattern(), dt + datetime.timedelta(minutes=5), self._insert_name)] with transaction.manager: DBSession.add_all(runs) DBSession.commit date = datetime.date.today() + datetime.timedelta(days=1) dayRuns = Run.get_runs_for_day(date) # Assert that the correct number of runs have been retrieved assert dayRuns == runs