def test_vtodo_serialization(todo_factory): """Test VTODO serialization: one field of each type.""" description = 'A tea would be nice, thanks.' todo = todo_factory( categories=['tea', 'drinking', 'hot'], description=description, due=datetime(3000, 3, 21), start=date(3000, 3, 21), priority=7, status='IN-PROCESS', summary='Some tea', rrule='FREQ=MONTHLY', ) writer = VtodoWritter(todo) vtodo = writer.serialize() assert ( [str(c) for c in vtodo.get('categories').cats] == ['tea', 'drinking', 'hot'] ) assert str(vtodo.get('description')) == description assert vtodo.get('priority') == 7 assert vtodo.decoded('due') == datetime(3000, 3, 21, tzinfo=tzlocal()) assert vtodo.decoded('dtstart') == date(3000, 3, 21) assert str(vtodo.get('status')) == 'IN-PROCESS' assert vtodo.get('rrule') == icalendar.vRecur.from_ical('FREQ=MONTHLY')
def test_vtodo_serialization(todo_factory): """Test VTODO serialization: one field of each type.""" description = 'A tea would be nice, thanks.' todo = todo_factory( categories=['tea', 'drinking', 'hot'], description=description, due=datetime(3000, 3, 21), priority=7, status='IN-PROCESS', summary='Some tea', ) writer = VtodoWritter(todo) vtodo = writer.serialize() assert str(vtodo.get('categories')) == 'tea,drinking,hot' assert str(vtodo.get('description')) == description assert vtodo.get('priority') == 7 assert vtodo.decoded('due') == datetime(3000, 3, 21, tzinfo=tzlocal()) assert str(vtodo.get('status')) == 'IN-PROCESS'