Example #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))
Example #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))
Example #3
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))
Example #4
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))
Example #5
0
    def test_ComponentFilter(self):
        """
        Component filter element.
        """
        for component_name, has in (
            ("VEVENT", True),
            ("VTODO", False),
        ):
            if has:
                no = "no "
            else:
                no = ""

            if has != storeComponentFilter(
                    ComponentFilter(ComponentFilter(name=component_name),
                                    name="VCALENDAR")).match(
                                        self.calendar, None):
                self.fail("Calendar has %s%s?" % (no, component_name))
Example #6
0
    def test_ComponentFilter(self):
        """
        Component filter element.
        """
        for component_name, has in (
            ("VEVENT", True),
            ("VTODO", False),
        ):
            if has:
                no = "no "
            else:
                no = ""

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