def test_find_all_outgoing_calls_for_phone_no_calls(self): identity = "sip/131313" limit = 10 result = call_log_dao.find_all_outgoing_for_phone(identity, limit) assert_that(result, has_length(0))
def test_find_all_outgoing_for_phone_limited(self): identity = "sip/131313" limit = 2 call_logs = _, call_log_1, call_log_2, call_log_3, _ = (self._mock_call_log(), self._mock_call_log(date=datetime(2015, 1, 1, 13), source_line_identity=identity), self._mock_call_log(date=datetime(2011, 1, 1, 13), source_line_identity=identity), self._mock_call_log(date=datetime(2015, 2, 1, 13), source_line_identity=identity), self._mock_call_log()) call_log_dao.create_from_list(call_logs) result = call_log_dao.find_all_outgoing_for_phone(identity, limit) assert_that(result, has_length(2)) assert_that(result[0].date, equal_to(call_log_3.date)) assert_that(result[1].date, equal_to(call_log_1.date)) assert_that(result[0].source_line_identity, equal_to(call_log_3.source_line_identity)) assert_that(result[1].source_line_identity, equal_to(call_log_1.source_line_identity))
def test_find_all_outgoing_for_phone_limited(self): identity = "sip/131313" limit = 2 call_logs = _, call_log_1, call_log_2, call_log_3, _ = ( self._mock_call_log(), self._mock_call_log(date=datetime(2015, 1, 1, 13), source_line_identity=identity), self._mock_call_log(date=datetime(2011, 1, 1, 13), source_line_identity=identity), self._mock_call_log(date=datetime(2015, 2, 1, 13), source_line_identity=identity), self._mock_call_log()) call_log_dao.create_from_list(call_logs) result = call_log_dao.find_all_outgoing_for_phone(identity, limit) assert_that(result, has_length(2)) assert_that(result[0].date, equal_to(call_log_3.date)) assert_that(result[1].date, equal_to(call_log_1.date)) assert_that(result[0].source_line_identity, equal_to(call_log_3.source_line_identity)) assert_that(result[1].source_line_identity, equal_to(call_log_1.source_line_identity))
def outgoing_calls_for_phone(identifier, limit): call_logs = call_log_dao.find_all_outgoing_for_phone(identifier, limit) return _convert_outgoing_call_logs(call_logs)