Skip to content
Permalink
Browse files

Test option to control what types of "record" can be an Organizer of …

…an event.

git-svn-id: https://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk@3408 e27351fd-9f3e-4f54-a53b-843176b1656c
  • Loading branch information...
cyrusdaboo committed Nov 24, 2008
1 parent b35c9a0 commit 2b4f66a29e78273382fc98d9b0f1f7a2a1ffcf84
Showing with 33 additions and 0 deletions.
  1. +33 −0 twistedcaldav/directory/test/test_principal.py
@@ -23,6 +23,7 @@
from twisted.web2.test.test_server import SimpleRequest

from twistedcaldav.static import CalendarHomeProvisioningFile
from twistedcaldav.config import config
from twistedcaldav.directory.apache import BasicDirectoryService, DigestDirectoryService
from twistedcaldav.directory.directory import DirectoryService
from twistedcaldav.directory.test.test_apache import basicUserFile, digestUserFile, groupFile, digestRealm
@@ -210,6 +211,38 @@ def test_enabledForCalendaring(self):
self.assertTrue(isinstance(principal, DirectoryPrincipalResource))
self.assertFalse(isinstance(principal, DirectoryCalendarPrincipalResource))

def test_enabledAsOrganizer(self):
"""
DirectoryPrincipalProvisioningResource.principalForCalendarUserAddress()
"""

ok_types = (
DirectoryService.recordType_users,
DirectoryService.recordType_groups,
)
for provisioningResource, recordType, recordResource, record in self._allRecords():

if record.enabledForCalendaring:
principal = provisioningResource.principalForRecord(record)
self.failIf(principal is None)
self.assertEqual(principal.enabledAsOrganizer(), recordType in ok_types)

config.Scheduling.Options.AllowGroupAsOrganizer = True
config.Scheduling.Options.AllowLocationAsOrganizer = True
config.Scheduling.Options.AllowResourceAsOrganizer = True
ok_types = (
DirectoryService.recordType_users,
DirectoryService.recordType_groups,
DirectoryService.recordType_locations,
DirectoryService.recordType_resources,
)
for provisioningResource, recordType, recordResource, record in self._allRecords():

if record.enabledForCalendaring:
principal = provisioningResource.principalForRecord(record)
self.failIf(principal is None)
self.assertEqual(principal.enabledAsOrganizer(), recordType in ok_types)

# FIXME: Run DirectoryPrincipalProvisioningResource tests on DirectoryPrincipalTypeProvisioningResource also

##

0 comments on commit 2b4f66a

Please sign in to comment.
You can’t perform that action at this time.