예제 #1
0
파일: test_dao.py 프로젝트: jaunis/xivo-dao
    def test_find_from_linked_id(self):
        linked_id = '666'
        cel_id_1, cel_id_2, cel_id_3 = self.add_cel(linkedid='666'), self.add_cel(linkedid='3'), self.add_cel(linkedid='666')

        result = cel_dao.find_from_linked_id(linked_id)

        assert_that(result, contains_inanyorder(has_property('id', cel_id_1),
                                                has_property('id', cel_id_3)))
예제 #2
0
파일: test_dao.py 프로젝트: jaunis/xivo-dao
    def test_find_from_linked_id(self):
        linked_id = '666'
        cel_id_1, cel_id_2, cel_id_3 = self.add_cel(
            linkedid='666'), self.add_cel(linkedid='3'), self.add_cel(
                linkedid='666')

        result = cel_dao.find_from_linked_id(linked_id)

        assert_that(
            result,
            contains_inanyorder(has_property('id', cel_id_1),
                                has_property('id', cel_id_3)))
예제 #3
0
파일: test_dao.py 프로젝트: jaunis/xivo-dao
    def test_find_from_linked_id_when_cels_are_unordered_then_return_cels_in_chronological_order(self):
        linked_id = '666'
        now = datetime.datetime.now()
        one_hour_ago = now - datetime.timedelta(hours=1)
        one_hour_later = now + datetime.timedelta(hours=1)
        cel_id_1, cel_id_2, cel_id_3 = [self.add_cel(linkedid='666', eventtime=now),
                                        self.add_cel(linkedid='666', eventtime=one_hour_ago),
                                        self.add_cel(linkedid='666', eventtime=one_hour_later)]

        result = cel_dao.find_from_linked_id(linked_id)

        assert_that(result, contains(has_property('id', cel_id_2),
                                     has_property('id', cel_id_1),
                                     has_property('id', cel_id_3)))
예제 #4
0
파일: test_dao.py 프로젝트: jaunis/xivo-dao
    def test_find_from_linked_id_when_cels_are_unordered_then_return_cels_in_chronological_order(
            self):
        linked_id = '666'
        now = datetime.datetime.now()
        one_hour_ago = now - datetime.timedelta(hours=1)
        one_hour_later = now + datetime.timedelta(hours=1)
        cel_id_1, cel_id_2, cel_id_3 = [
            self.add_cel(linkedid='666', eventtime=now),
            self.add_cel(linkedid='666', eventtime=one_hour_ago),
            self.add_cel(linkedid='666', eventtime=one_hour_later)
        ]

        result = cel_dao.find_from_linked_id(linked_id)

        assert_that(
            result,
            contains(has_property('id',
                                  cel_id_2), has_property('id', cel_id_1),
                     has_property('id', cel_id_3)))
예제 #5
0
파일: test_dao.py 프로젝트: jaunis/xivo-dao
    def test_find_from_linked_id_no_cels(self):
        linked_id = '666'

        result = cel_dao.find_from_linked_id(linked_id)

        assert_that(result, contains())
예제 #6
0
파일: test_dao.py 프로젝트: jaunis/xivo-dao
    def test_find_from_linked_id_no_cels(self):
        linked_id = '666'

        result = cel_dao.find_from_linked_id(linked_id)

        assert_that(result, contains())