Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
C4ptainCrunch committed Aug 5, 2019
1 parent 651d827 commit 162510c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
23 changes: 14 additions & 9 deletions tests/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ics.event import Event
from ics.icalendar import Calendar
from ics.parse import Container
from .fixture import cal12, cal13, cal15, cal16, cal17, cal18, cal19, cal20, cal32
from .fixture import cal12, cal13, cal15, cal16, cal17, cal18, cal19, cal19bis, cal20, cal32

CRLF = "\r\n"

Expand Down Expand Up @@ -267,7 +267,6 @@ def test_escape_output(self):
"SUMMARY:Hello\\, with \\\\ special\\; chars and \\n newlines",
"DESCRIPTION:Every\\nwhere ! Yes\\, yes !",
"LOCATION:Here\\; too",
"TRANSP:OPAQUE",
"UID:empty-uid",
"END:VEVENT"))
self.assertEqual(str(e), eq)
Expand Down Expand Up @@ -348,21 +347,27 @@ def test_all_day_outputs_dtstart_value_date(self):

def test_transparent_input(self):
c = Calendar(cal19)
e = next(iter(c.events))
self.assertEqual(e.transparent, False)
e1 = list(c.events)[0]
self.assertEqual(e1.transparent, False)

def test_transparent_output(self):
TRANSPARENT = True
e = Event(name="Name", transparent=TRANSPARENT)
self.assertIn("TRANSP:TRANSPARENT", str(e).splitlines())
c2 = Calendar(cal19bis)
e2 = list(c2.events)[0]
self.assertEqual(e2.transparent, True)

def test_default_transparent_input(self):
c = Calendar(cal18)
e = next(iter(c.events))
self.assertEqual(e.transparent, False)
self.assertEqual(e.transparent, None)

def test_default_transparent_output(self):
e = Event(name="Name")
self.assertNotIn("TRANSP:OPAQUE", str(e).splitlines())

def test_transparent_output(self):
e = Event(name="Name", transparent=True)
self.assertIn("TRANSP:TRANSPARENT", str(e).splitlines())

e = Event(name="Name", transparent=False)
self.assertIn("TRANSP:OPAQUE", str(e).splitlines())

def test_includes_disjoined(self):
Expand Down
20 changes: 16 additions & 4 deletions tests/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,24 @@
PRODID:-//Apple Inc.//Mac OS X 10.9//EN
BEGIN:VEVENT
SUMMARY:Hello, \\n World\\; This is a backslash : \\\\ and another new \\N line
DTSTART;TZID=Europe/Berlin:20120608T202500
DTEND;TZID=Europe/Berlin:20120608T212500
LOCATION:MUC
SUMMARY:E1
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
"""


# Event with TRANSP
cal19bis = u"""
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//Mac OS X 10.9//EN
BEGIN:VEVENT
SUMMARY:E2
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
"""

Expand Down

0 comments on commit 162510c

Please sign in to comment.