Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caldav_alarm.c: switch from using mboxname to mboxid + inboxid #4842

Open
wants to merge 2 commits into
base: mboxlist_inboxid
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions cassandane/tiny-tests/CaldavAlarm/simple_renameuser
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'});
}
Loading
Loading