예제 #1
0
파일: tests.py 프로젝트: tBaxter/vobject
    def test_general_behavior(self):
        """
        Tests for behavior registry, getting and creating a behavior.
        """
        # Check expected behavior registry.
        self.assertEqual(
            sorted(behavior_registry.keys()),
            ['', 'ACTION', 'ADR', 'AVAILABLE', 'BUSYTYPE', 'CALSCALE', 'CATEGORIES', 'CLASS', 'COMMENT', 'COMPLETED', 'CONTACT', 'CREATED', 'DAYLIGHT', 'DESCRIPTION', 'DTEND', 'DTSTAMP', 'DTSTART', 'DUE', 'DURATION', 'EXDATE', 'EXRULE', 'FN', 'FREEBUSY', 'LABEL', 'LAST-MODIFIED', 'LOCATION', 'METHOD', 'N', 'ORG', 'PHOTO', 'PRODID', 'RDATE', 'RECURRENCE-ID', 'RELATED-TO', 'REQUEST-STATUS', 'RESOURCES', 'RRULE', 'STANDARD', 'STATUS', 'SUMMARY', 'TRANSP', 'TRIGGER', 'UID', 'VALARM', 'VAVAILABILITY', 'VCALENDAR', 'VCARD', 'VEVENT', 'VFREEBUSY', 'VJOURNAL', 'VTIMEZONE', 'VTODO']
        )

        # test get_behavior
        behavior = base.getBehavior('VCALENDAR')
        self.assertEqual(
            str(behavior),
            "<class 'vobject.icalendar.VCalendar2_0'>"
        )
        self.assertTrue(behavior.isComponent)

        self.assertEqual(
            base.getBehavior("invalid_name"),
            None
        )
        # test for ContentLine (not a component)
        non_component_behavior = base.getBehavior('RDATE')
        self.assertFalse(non_component_behavior.isComponent)
예제 #2
0
    def test_general_behavior(self):
        """
        Tests for behavior registry, getting and creating a behavior.
        """
        # Check expected behavior registry.
        self.assertEqual(sorted(behavior_registry.keys()), [
            '', 'ACTION', 'ADR', 'AVAILABLE', 'BUSYTYPE', 'CALSCALE',
            'CATEGORIES', 'CLASS', 'COMMENT', 'COMPLETED', 'CONTACT',
            'CREATED', 'DAYLIGHT', 'DESCRIPTION', 'DTEND', 'DTSTAMP',
            'DTSTART', 'DUE', 'DURATION', 'EXDATE', 'EXRULE', 'FN', 'FREEBUSY',
            'LABEL', 'LAST-MODIFIED', 'LOCATION', 'METHOD', 'N', 'ORG',
            'PHOTO', 'PRODID', 'RDATE', 'RECURRENCE-ID', 'RELATED-TO',
            'REQUEST-STATUS', 'RESOURCES', 'RRULE', 'STANDARD', 'STATUS',
            'SUMMARY', 'TRANSP', 'TRIGGER', 'UID', 'VALARM', 'VAVAILABILITY',
            'VCALENDAR', 'VCARD', 'VEVENT', 'VFREEBUSY', 'VJOURNAL',
            'VTIMEZONE', 'VTODO'
        ])

        # test get_behavior
        behavior = base.getBehavior('VCALENDAR')
        self.assertEqual(str(behavior),
                         "<class 'vobject.icalendar.VCalendar2_0'>")
        self.assertTrue(behavior.isComponent)

        self.assertEqual(base.getBehavior("invalid_name"), None)
        # test for ContentLine (not a component)
        non_component_behavior = base.getBehavior('RDATE')
        self.assertFalse(non_component_behavior.isComponent)
예제 #3
0
 def test_default_behavior(self):
     """
     Default behavior test.
     """
     card = self.card
     self.assertEqual(base.getBehavior('note'), None)
     self.assertEqual(
         str(card.note.value),
         "The Mayor of the great city of Goerlitz in the great country of Germany.\nNext line."
     )
예제 #4
0
파일: tests.py 프로젝트: tBaxter/vobject
 def test_default_behavior(self):
     """
     Default behavior test.
     """
     card = self.card
     self.assertEqual(
         base.getBehavior('note'),
         None
     )
     self.assertEqual(
         str(card.note.value),
         "The Mayor of the great city of Goerlitz in the great country of Germany.\nNext line."
     )