Exemplo n.º 1
0
    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)))
Exemplo n.º 2
0
    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)))
Exemplo n.º 3
0
    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)))
Exemplo n.º 4
0
    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)))
Exemplo n.º 5
0
    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())
Exemplo n.º 6
0
    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())