This repository has been archived by the owner on Feb 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://svn.calendarserver.org/repository/calendarserver/CalendarServer/branches/release/CalendarServer-3.0-dev@7598 e27351fd-9f3e-4f54-a53b-843176b1656c
- Loading branch information
Showing
5 changed files
with
83 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
from twistedcaldav.mail import MailHandler | ||
from twistedcaldav.mail import MailGatewayTokensDatabase | ||
import os | ||
import datetime | ||
|
||
|
||
def echo(*args): | ||
|
@@ -38,6 +39,32 @@ def setUp(self): | |
self.handler = MailHandler(dataRoot=":memory:") | ||
self.dataDir = os.path.join(os.path.dirname(__file__), "data", "mail") | ||
|
||
|
||
def test_purge(self): | ||
""" | ||
Ensure that purge( ) cleans out old tokens | ||
""" | ||
|
||
# Insert an "old" token | ||
token = "test_token" | ||
organizer = "[email protected]" | ||
attendee = "[email protected]" | ||
icaluid = "123" | ||
pastDate = datetime.date(2009,1,1) | ||
self.handler.db._db_execute( | ||
""" | ||
insert into TOKENS (TOKEN, ORGANIZER, ATTENDEE, ICALUID, DATESTAMP) | ||
values (:1, :2, :3, :4, :5) | ||
""", token, organizer, attendee, icaluid, pastDate | ||
) | ||
self.handler.db._db_commit() | ||
|
||
# purge, and make sure we don't see that token anymore | ||
self.handler.purge() | ||
retrieved = self.handler.db.getToken(organizer, attendee, icaluid) | ||
self.assertEquals(retrieved, None) | ||
|
||
|
||
def test_iconPath(self): | ||
iconPath = self.handler.getIconPath({'day':'1', 'month':'1'}, False, language='en') | ||
iconDir = "/usr/share/caldavd/share/date_icons" | ||
|