Exemplo n.º 1
0
    def test_query_text(self):
        """
        Basic query test with time range
        """

        filter = caldavxml.Filter(
            caldavxml.ComponentFilter(
                *[
                    caldavxml.ComponentFilter(
                        caldavxml.PropertyFilter(
                            caldavxml.TextMatch.fromString("1234", False),
                            name="UID",
                        ), **{"name": ("VEVENT")}),
                ], **{
                    "name": "VCALENDAR",
                    "test": "anyof"
                }))
        filter = Filter(filter)
        filter.child.settzinfo(Timezone(tzid="America/New_York"))
        j = filter.serialize()
        self.assertEqual(j["type"], "Filter")

        f = FilterBase.deserialize(j)
        self.assertTrue(isinstance(f, Filter))
        self.assertTrue(
            isinstance(f.child.filters[0].filters[0], PropertyFilter))
        self.assertTrue(
            isinstance(f.child.filters[0].filters[0].qualifier, TextMatch))
        self.assertEqual(f.child.filters[0].filters[0].qualifier.text, "1234")
Exemplo n.º 2
0
    def test_calendar_query_by_uid(self):
        """
        Event by UID.
        (CalDAV-access-09, section 7.6.6)
        """
        uid = "C3189A88-1ED0-11D9-A5E0-000A958A3252"

        return self.simple_event_query(
            caldavxml.PropertyFilter(
                caldavxml.TextMatch.fromString(uid, False),
                name="UID",
            ), [uid])