-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1271 from pimutils/feature/status
Better support for status and initial support for partstat
- Loading branch information
Showing
13 changed files
with
162 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
[[work]] | ||
path = ~/.calendars/work/ | ||
readonly = True | ||
addresses = [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,7 @@ def coll_vdirs(tmpdir) -> CollVdirType: | |
color='dark blue', | ||
priority=10, | ||
ctype='calendar', | ||
addresses='[email protected]', | ||
) | ||
vdirs[name] = Vdir(path, '.ics') | ||
coll = CalendarCollection(calendars=calendars, dbpath=':memory:', locale=LOCALE_BERLIN) | ||
|
@@ -71,7 +72,8 @@ def coll_vdirs_birthday(tmpdir): | |
os.makedirs(path, mode=0o770) | ||
readonly = True if name == 'a_calendar' else False | ||
calendars[name] = {'name': name, 'path': path, 'color': 'dark blue', | ||
'readonly': readonly, 'unicode_symbols': True, 'ctype': 'birthdays'} | ||
'readonly': readonly, 'unicode_symbols': True, 'ctype': 'birthdays', | ||
'addresses': '[email protected]'} | ||
vdirs[name] = Vdir(path, '.vcf') | ||
coll = CalendarCollection(calendars=calendars, dbpath=':memory:', locale=LOCALE_BERLIN) | ||
coll.default_calendar_name = cal1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -326,6 +326,15 @@ def test_event_rd(): | |
assert event.recurring is True | ||
|
||
|
||
def test_status_confirmed(): | ||
event = Event.fromString(_get_text('event_dt_status_confirmed'), **EVENT_KWARGS) | ||
assert event.status == 'CONFIRMED' | ||
FORMAT_CALENDAR = ('{calendar-color}{status-symbol}{start-end-time-style} ({calendar}) ' | ||
'{title} [{location}]{repeat-symbol}') | ||
|
||
assert human_formatter(FORMAT_CALENDAR)(event.attributes(dt.date(2014, 4, 9))) == \ | ||
'✔09:30-10:30 (foobar) An Event []\x1b[0m' | ||
|
||
def test_event_d_long(): | ||
event_d_long = _get_text('event_d_long') | ||
event = Event.fromString(event_d_long, **EVENT_KWARGS) | ||
|
@@ -686,3 +695,37 @@ def test_parameters_description(): | |
assert event.description == ( | ||
'Hey, \n\nJust setting aside some dedicated time to talk about redacted.' | ||
) | ||
|
||
def test_partstat(): | ||
FORMAT_CALENDAR = ( | ||
'{calendar-color}{partstat-symbol}{status-symbol}{start-end-time-style} ({calendar}) ' | ||
'{title} [{location}]{repeat-symbol}' | ||
) | ||
|
||
event = Event.fromString( | ||
_get_text('event_dt_partstat'), addresses=['[email protected]'], **EVENT_KWARGS) | ||
assert event.partstat == 'ACCEPTED' | ||
assert human_formatter(FORMAT_CALENDAR)(event.attributes(dt.date(2014, 4, 9))) == \ | ||
'✔09:30-10:30 (foobar) An Event []\x1b[0m' | ||
|
||
event = Event.fromString( | ||
_get_text('event_dt_partstat'), addresses=['[email protected]'], **EVENT_KWARGS) | ||
assert event.partstat == 'DECLINED' | ||
assert human_formatter(FORMAT_CALENDAR)(event.attributes(dt.date(2014, 4, 9))) == \ | ||
'❌09:30-10:30 (foobar) An Event []\x1b[0m' | ||
|
||
event = Event.fromString( | ||
_get_text('event_dt_partstat'), addresses=['[email protected]'], **EVENT_KWARGS) | ||
assert event.partstat == 'ACCEPTED' | ||
assert human_formatter(FORMAT_CALENDAR)(event.attributes(dt.date(2014, 4, 9))) == \ | ||
'✔09:30-10:30 (foobar) An Event []\x1b[0m' | ||
|
||
@pytest.mark.xfail | ||
def test_partstat_deligated(): | ||
event = Event.fromString( | ||
_get_text('event_dt_partstat'), addresses=['[email protected]'], **EVENT_KWARGS) | ||
assert event.partstat == 'ACCEPTED' | ||
|
||
event = Event.fromString( | ||
_get_text('event_dt_partstat'), addresses=['[email protected]'], **EVENT_KWARGS) | ||
assert event.partstat == 'ACCEPTED' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
BEGIN:VCALENDAR | ||
VERSION:2.0 | ||
PRODID:-//PIMUTILS.ORG//NONSGML khal / icalendar //EN | ||
BEGIN:VEVENT | ||
SUMMARY:An Event | ||
DTSTART;TZID=Europe/Berlin:20140409T093000 | ||
DTEND;TZID=Europe/Berlin:20140409T103000 | ||
DTSTAMP:20140401T234817Z | ||
UID:V042MJ8B3SJNFXQOJL6P53OFMHJE8Z3VZWOU | ||
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;DELEGATED-FROM= | ||
"mailto:[email protected]";CN=Henry Cabot:mailto:hcabot@ | ||
example.com | ||
ATTENDEE;ROLE=NON-PARTICIPANT;PARTSTAT=DELEGATED;DELEGATED-TO= | ||
"mailto:[email protected]";CN=The Big Cheese:mailto:iamboss | ||
@example.com | ||
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Jane Doe | ||
:mailto:[email protected] | ||
ATTENDEE;PARTSTAT=ACCEPTED:mailto:[email protected] | ||
ATTENDEE;PARTSTAT=DECLINED:mailto:[email protected] | ||
ATTENDEE;PARTSTAT=TENTATIVE:mailto:[email protected] | ||
END:VEVENT | ||
END:VCALENDAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
BEGIN:VCALENDAR | ||
VERSION:2.0 | ||
PRODID:-//PIMUTILS.ORG//NONSGML khal / icalendar //EN | ||
BEGIN:VEVENT | ||
SUMMARY:An Event | ||
DTSTART;TZID=Europe/Berlin:20140409T093000 | ||
DTEND;TZID=Europe/Berlin:20140409T103000 | ||
DTSTAMP:20140401T234817Z | ||
UID:V042MJ8B3SJNFXQOJL6P53OFMHJE8Z3VZWOU | ||
STATUS:CONFIRMED | ||
END:VEVENT | ||
END:VCALENDAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,10 +40,14 @@ def test_simple_config(self): | |
) | ||
comp_config = { | ||
'calendars': { | ||
'home': {'path': os.path.expanduser('~/.calendars/home/'), | ||
'readonly': False, 'color': None, 'priority': 10, 'type': 'calendar'}, | ||
'work': {'path': os.path.expanduser('~/.calendars/work/'), | ||
'readonly': False, 'color': None, 'priority': 10, 'type': 'calendar'}, | ||
'home': { | ||
'path': os.path.expanduser('~/.calendars/home/'), 'readonly': False, | ||
'color': None, 'priority': 10, 'type': 'calendar', 'addresses': [''], | ||
}, | ||
'work': { | ||
'path': os.path.expanduser('~/.calendars/work/'), 'readonly': False, | ||
'color': None, 'priority': 10, 'type': 'calendar', 'addresses': [''], | ||
}, | ||
}, | ||
'sqlite': {'path': os.path.expanduser('~/.local/share/khal/khal.db')}, | ||
'locale': LOCALE_BERLIN, | ||
|
@@ -81,10 +85,10 @@ def test_small(self): | |
'calendars': { | ||
'home': {'path': os.path.expanduser('~/.calendars/home/'), | ||
'color': 'dark green', 'readonly': False, 'priority': 20, | ||
'type': 'calendar'}, | ||
'type': 'calendar', 'addresses': ['']}, | ||
'work': {'path': os.path.expanduser('~/.calendars/work/'), | ||
'readonly': True, 'color': None, 'priority': 10, | ||
'type': 'calendar'}}, | ||
'type': 'calendar', 'addresses': ['[email protected]']}}, | ||
'sqlite': {'path': os.path.expanduser('~/.local/share/khal/khal.db')}, | ||
'locale': { | ||
'local_timezone': get_localzone(), | ||
|