Exemple #1
0
    def test_TextMatch(self):
        """
        Text match element.
        """
        for uid, caseless, has in (
            ("C3184A66-1ED0-11D9-A5E0-000A958A3252", False, True),
            ("c3184a66-1ed0-11d9-a5e0-000a958a3252", True, True),
            ("BOOGER", False, False),
            ("BOOGER", True, False),
        ):
            if has:
                no = "no "
            else:
                no = ""

            if has != storeComponentFilter(
                ComponentFilter(
                    ComponentFilter(
                        PropertyFilter(
                            TextMatch.fromString(uid, caseless=caseless),
                            name="UID"
                        ),
                        name="VEVENT"
                    ),
                    name="VCALENDAR"
                )
            ).match(self.calendar, None):
                self.fail("Calendar has %sVEVENT with UID %s? (caseless=%s)" % (no, uid, caseless))
Exemple #2
0
    def test_PropertyFilter(self):
        """
        Property filter element.
        """
        for property_name, has in (
            ("UID", True),
            ("BOOGER", False),
        ):
            if has:
                no = "no "
            else:
                no = ""

            if has != storeComponentFilter(
                ComponentFilter(
                    ComponentFilter(
                        PropertyFilter(
                            name=property_name
                        ),
                        name="VEVENT"
                    ),
                    name="VCALENDAR"
                )
            ).match(self.calendar, None):
                self.fail("Calendar has %sVEVENT with %s?" % (no, property_name))