[CalendarServer-changes] [10802] CalendarServer/trunk/twext/who/test
source_changes at macosforge.org
source_changes at macosforge.org
Thu Feb 21 20:59:43 PST 2013
Revision: 10802
http://trac.calendarserver.org//changeset/10802
Author: wsanchez at apple.com
Date: 2013-02-21 20:59:43 -0800 (Thu, 21 Feb 2013)
Log Message:
-----------
Test immutableness.
Modified Paths:
--------------
CalendarServer/trunk/twext/who/test/test_aggregate.py
CalendarServer/trunk/twext/who/test/test_directory.py
Modified: CalendarServer/trunk/twext/who/test/test_aggregate.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_aggregate.py 2013-02-22 04:59:23 UTC (rev 10801)
+++ CalendarServer/trunk/twext/who/test/test_aggregate.py 2013-02-22 04:59:43 UTC (rev 10802)
@@ -23,7 +23,7 @@
from twext.who.idirectory import IDirectoryService
from twext.who.aggregate import DirectoryService
-from twext.who.test import test_xml
+from twext.who.test import test_directory, test_xml
from twext.who.test.test_xml import QueryMixIn, xmlService
@@ -63,3 +63,8 @@
class DirectoryServiceQueryTest(BaseTest, test_xml.DirectoryServiceQueryTest):
pass
+
+
+
+class DirectoryServiceImmutableTest(BaseTest, test_directory.DirectoryServiceImmutableTest):
+ pass
Modified: CalendarServer/trunk/twext/who/test/test_directory.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_directory.py 2013-02-22 04:59:23 UTC (rev 10801)
+++ CalendarServer/trunk/twext/who/test/test_directory.py 2013-02-22 04:59:43 UTC (rev 10802)
@@ -24,7 +24,7 @@
from twisted.trial.unittest import SkipTest
from twisted.internet.defer import inlineCallbacks
-from twext.who.idirectory import QueryNotSupportedError
+from twext.who.idirectory import QueryNotSupportedError, NotAllowedError
from twext.who.idirectory import RecordType, FieldName
from twext.who.idirectory import IDirectoryService, IDirectoryRecord
from twext.who.directory import DirectoryService, DirectoryRecord
@@ -85,20 +85,59 @@
def test_recordWithUID(self):
raise SkipTest("Subclasses should implement this test.")
+
def test_recordWithGUID(self):
raise SkipTest("Subclasses should implement this test.")
+
def test_recordsWithRecordType(self):
raise SkipTest("Subclasses should implement this test.")
+
def test_recordWithShortName(self):
raise SkipTest("Subclasses should implement this test.")
+
def test_recordsWithEmailAddress(self):
raise SkipTest("Subclasses should implement this test.")
+class DirectoryServiceImmutableTest(BaseTest):
+ def test_updateRecordsNotAllowed(self):
+ service = self.service()
+
+ newRecord = DirectoryRecord(
+ service,
+ fields = {
+ service.fieldName.uid: "__plugh__",
+ service.fieldName.recordType: service.recordType.user,
+ service.fieldName.shortNames: ("plugh",),
+ }
+ )
+
+ self.assertFailure(
+ service.updateRecords((newRecord,), create=True),
+ NotAllowedError,
+ )
+
+ self.assertFailure(
+ service.updateRecords((newRecord,), create=False),
+ NotAllowedError,
+ )
+
+
+ def test_removeRecordsNotAllowed(self):
+ service = self.service()
+
+ service.removeRecords(())
+ self.assertFailure(
+ service.removeRecords(("foo",)),
+ NotAllowedError,
+ )
+
+
+
class DirectoryRecordTest(BaseTest):
fields_wsanchez = {
FieldName.uid: "UID:wsanchez",
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130221/7c598d06/attachment.html>
More information about the calendarserver-changes
mailing list