def test_find_all_in_period_not_found(self): expected_result = [] start, end = datetime(2013, 1, 1), datetime(2013, 2, 1) result = call_log_dao.find_all_in_period(start, end) assert_that(result, equal_to(expected_result))
def test_find_all_in_period_found(self): call_logs = _, call_log_1, call_log_2, _ = (self._mock_call_log(date=datetime(2012, 1, 1, 13)), self._mock_call_log(date=datetime(2013, 1, 1, 13)), self._mock_call_log(date=datetime(2013, 1, 2, 13)), self._mock_call_log(date=datetime(2014, 1, 1, 13))) start = datetime(2013, 1, 1, 12) end = datetime(2013, 1, 3, 12) call_log_dao.create_from_list(call_logs) result = call_log_dao.find_all_in_period(start, end) assert_that(result, has_length(2)) assert_that(result, contains_inanyorder(has_property('date', call_log_1.date), has_property('date', call_log_2.date)))
def test_find_all_in_period_found(self): call_logs = _, call_log_1, call_log_2, _ = ( self._mock_call_log(date=datetime(2012, 1, 1, 13)), self._mock_call_log(date=datetime(2013, 1, 1, 13)), self._mock_call_log(date=datetime(2013, 1, 2, 13)), self._mock_call_log(date=datetime(2014, 1, 1, 13))) start = datetime(2013, 1, 1, 12) end = datetime(2013, 1, 3, 12) call_log_dao.create_from_list(call_logs) result = call_log_dao.find_all_in_period(start, end) assert_that(result, has_length(2)) assert_that( result, contains_inanyorder(has_property('date', call_log_1.date), has_property('date', call_log_2.date)))
def find_all_in_period(start, end): _validate_datetimes(start, end) return dao.find_all_in_period(start, end)