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 'card_me.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)
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 'card_me.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)
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." )
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." )