[CalendarServer-changes] [10689] CalendarServer/trunk/twext/who
source_changes at macosforge.org
source_changes at macosforge.org
Mon Feb 11 15:29:01 PST 2013
Revision: 10689
http://trac.calendarserver.org//changeset/10689
Author: wsanchez at apple.com
Date: 2013-02-11 15:29:01 -0800 (Mon, 11 Feb 2013)
Log Message:
-----------
Test __repr__
Modified Paths:
--------------
CalendarServer/trunk/twext/who/directory.py
CalendarServer/trunk/twext/who/test/test_directory.py
CalendarServer/trunk/twext/who/test/test_xml.py
CalendarServer/trunk/twext/who/xml.py
Modified: CalendarServer/trunk/twext/who/directory.py
===================================================================
--- CalendarServer/trunk/twext/who/directory.py 2013-02-11 23:14:20 UTC (rev 10688)
+++ CalendarServer/trunk/twext/who/directory.py 2013-02-11 23:29:01 UTC (rev 10689)
@@ -54,7 +54,7 @@
def __repr__(self):
- return "<%s %s>" % (
+ return "<%s %r>" % (
self.__class__.__name__,
self.realmName,
)
Modified: CalendarServer/trunk/twext/who/test/test_directory.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_directory.py 2013-02-11 23:14:20 UTC (rev 10688)
+++ CalendarServer/trunk/twext/who/test/test_directory.py 2013-02-11 23:29:01 UTC (rev 10689)
@@ -56,6 +56,11 @@
self.assertEquals(service.realmName, self.realmName)
+ def test_repr(self):
+ service = self._testService()
+ self.assertEquals(repr(service), "<DirectoryService 'xyzzy'>")
+
+
@inlineCallbacks
def test_recordTypes(self):
service = self._testService()
Modified: CalendarServer/trunk/twext/who/test/test_xml.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_xml.py 2013-02-11 23:14:20 UTC (rev 10688)
+++ CalendarServer/trunk/twext/who/test/test_xml.py 2013-02-11 23:29:01 UTC (rev 10689)
@@ -165,6 +165,14 @@
class DirectoryServiceTest(BaseTest, test_directory.DirectoryServiceTest):
+ def test_repr(self):
+ service = self._testService()
+
+ self.assertEquals(repr(service), "<DirectoryService (not loaded)>")
+ service.loadRecords()
+ self.assertEquals(repr(service), "<DirectoryService 'xyzzy'>")
+
+
@inlineCallbacks
def test_recordWithUID(self):
service = self._testService()
Modified: CalendarServer/trunk/twext/who/xml.py
===================================================================
--- CalendarServer/trunk/twext/who/xml.py 2013-02-11 23:14:20 UTC (rev 10688)
+++ CalendarServer/trunk/twext/who/xml.py 2013-02-11 23:29:01 UTC (rev 10689)
@@ -168,9 +168,15 @@
def __repr__(self):
+ realmName = self._realmName
+ if realmName is None:
+ realmName = "(not loaded)"
+ else:
+ realmName = repr(realmName)
+
return "<%s %s>" % (
self.__class__.__name__,
- self._realmName,
+ realmName,
)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130211/bc0eb4d1/attachment-0001.html>
More information about the calendarserver-changes
mailing list