Exemplo n.º 1
0
 def _create_ical_and_check_multi_byte_chars(self, prefix):
     event = Event(id=999, title=u'Test', description=prefix + u'ä' * 50)
     request = RequestFactory().get('/feed.ics')
     entry = ical_service.create_ical_entry(event, request)
     ical_string = entry.as_string()
     self.assertIn("ääää\r\n ääää", ical_string)
     self.assertEqual(ical_string.count("ä"), 50)
Exemplo n.º 2
0
 def test_create_ical_entry(self):
     now_local = timezone.localtime(timezone.now())
     tomorrow_local = now_local + datetime.timedelta(days=1)
     tomorrow_190000 = tomorrow_local.replace(hour=19, minute=0, second=0)
     tomorrow_190000_utc = tomorrow_190000.astimezone(timezone.utc)
     dtstart = tomorrow_190000_utc.strftime("%Y%m%dT%H%M%SZ")
     tomorrow_220000 = tomorrow_local.replace(hour=22, minute=0, second=0)
     tomorrow_220000_utc = tomorrow_220000.astimezone(timezone.utc)
     dtend = tomorrow_220000_utc.strftime("%Y%m%dT%H%M%SZ")
     
     event = Event.objects.get(id=1)
     request = RequestFactory().get('/feed.ics')
     entry = ical_service.create_ical_entry(event, request)
     ical_string = entry.as_string()
     self.assertIn("SUMMARY:Future event with end date", ical_string)
     self.assertIn("DTSTART:%s" % dtstart, ical_string)
     self.assertIn("DTEND:%s" % dtend, ical_string)
     self.assertIn("DTSTAMP:", ical_string)
     self.assertIn("UID:[email protected]", ical_string)
     self.assertIn("SEQUENCE:", ical_string)
     self.assertIn("CREATED:20120923T145234Z", ical_string)
     self.assertIn("DESCRIPTION:", ical_string)
     self.assertIn("LAST-MODIFIED:20120923T145609Z", ical_string)
     self.assertIn("STATUS:CONFIRMED", ical_string)
     self.assertIn("URL:", ical_string)