-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
caldav_alarm.c: switch from using mboxname to mboxid + inboxid
- Loading branch information
1 parent
19c4d9c
commit 75d6641
Showing
6 changed files
with
313 additions
and
107 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!perl | ||
use Cassandane::Tiny; | ||
|
||
sub test_simple_renameuser | ||
:min_version_3_0 :needs_component_calalarmd :NoAltNameSpace :AllowMoves | ||
{ | ||
my ($self) = @_; | ||
|
||
my $CalDAV = $self->{caldav}; | ||
|
||
my $CalendarId = $CalDAV->NewCalendar({name => 'foo'}); | ||
$self->assert_not_null($CalendarId); | ||
|
||
my $now = DateTime->now(); | ||
$now->set_time_zone('Australia/Sydney'); | ||
# bump everything forward so a slow run (say: valgrind) | ||
# doesn't cause things to magically fire... | ||
$now->add(DateTime::Duration->new(seconds => 300)); | ||
|
||
# define the event to start in a few seconds | ||
my $startdt = $now->clone(); | ||
$startdt->add(DateTime::Duration->new(seconds => 2)); | ||
my $start = $startdt->strftime('%Y%m%dT%H%M%S'); | ||
|
||
my $enddt = $startdt->clone(); | ||
$enddt->add(DateTime::Duration->new(seconds => 15)); | ||
my $end = $enddt->strftime('%Y%m%dT%H%M%S'); | ||
|
||
# set the trigger to notify us at the start of the event | ||
my $trigger="PT0S"; | ||
|
||
my $uuid = "574E2CD0-2D2A-4554-8B63-C7504481D3A9"; | ||
my $href = "$CalendarId/$uuid.ics"; | ||
my $card = <<EOF; | ||
BEGIN:VCALENDAR | ||
VERSION:2.0 | ||
PRODID:-//Apple Inc.//Mac OS X 10.10.4//EN | ||
CALSCALE:GREGORIAN | ||
BEGIN:VTIMEZONE | ||
TZID:Australia/Sydney | ||
BEGIN:STANDARD | ||
DTSTART:19700101T000000 | ||
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 | ||
TZOFFSETFROM:+1100 | ||
TZOFFSETTO:+1000 | ||
END:STANDARD | ||
BEGIN:DAYLIGHT | ||
DTSTART:19700101T000000 | ||
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=10 | ||
TZOFFSETFROM:+1000 | ||
TZOFFSETTO:+1100 | ||
END:DAYLIGHT | ||
END:VTIMEZONE | ||
BEGIN:VEVENT | ||
CREATED:20150806T234327Z | ||
UID:574E2CD0-2D2A-4554-8B63-C7504481D3A9 | ||
DTEND;TZID=Australia/Sydney:$end | ||
TRANSP:OPAQUE | ||
SUMMARY:Simple | ||
DTSTART;TZID=Australia/Sydney:$start | ||
DTSTAMP:20150806T234327Z | ||
SEQUENCE:0 | ||
BEGIN:VALARM | ||
TRIGGER:$trigger | ||
ACTION:DISPLAY | ||
SUMMARY: My alarm | ||
DESCRIPTION:My alarm has triggered | ||
END:VALARM | ||
END:VEVENT | ||
END:VCALENDAR | ||
EOF | ||
|
||
$CalDAV->Request('PUT', $href, $card, 'Content-Type' => 'text/calendar'); | ||
|
||
my $AdminTalk = $self->{adminstore}->get_client(); | ||
$AdminTalk->rename("user.cassandane", "user.foo"); | ||
|
||
# clean notification cache | ||
$self->{instance}->getnotify(); | ||
|
||
$self->{instance}->run_command({ cyrus => 1 }, 'calalarmd', '-t' => $now->epoch() - 60 ); | ||
|
||
$self->assert_alarms(); | ||
|
||
$self->{instance}->run_command({ cyrus => 1 }, 'calalarmd', '-t' => $now->epoch() + 60 ); | ||
|
||
$self->assert_alarms({summary => 'Simple', start => $start, timezone => 'Australia/Sydney'}); | ||
} |
Oops, something went wrong.