コード例 #1
0
    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))
コード例 #2
0
ファイル: test_dao.py プロジェクト: jaunis/xivo-dao
    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))
コード例 #3
0
ファイル: test_dao.py プロジェクト: jaunis/xivo-dao
    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)))
コード例 #4
0
    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)))
コード例 #5
0
ファイル: services.py プロジェクト: jaunis/xivo-dao
def find_all_in_period(start, end):
    _validate_datetimes(start, end)
    return dao.find_all_in_period(start, end)