[CalendarServer-changes] [10773] CalendarServer/trunk/twext/who/test/test_xml.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Feb 21 10:10:24 PST 2013
Revision: 10773
http://trac.calendarserver.org//changeset/10773
Author: wsanchez at apple.com
Date: 2013-02-21 10:10:24 -0800 (Thu, 21 Feb 2013)
Log Message:
-----------
Move test service creation to a function to reuse elsewhere.
Modified Paths:
--------------
CalendarServer/trunk/twext/who/test/test_xml.py
Modified: CalendarServer/trunk/twext/who/test/test_xml.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_xml.py 2013-02-21 17:57:48 UTC (rev 10772)
+++ CalendarServer/trunk/twext/who/test/test_xml.py 2013-02-21 18:10:24 UTC (rev 10773)
@@ -156,26 +156,10 @@
class BaseTest(object):
def service(self, xmlData=None):
- if xmlData is None:
- xmlData = testXMLConfig
+ return xmlService(self.mktemp(), xmlData)
- filePath = FilePath(self.mktemp())
- filePath.setContent(xmlData)
- class TestService(DirectoryService):
- def query(self, field, value, matchType=MatchType.equals, flags=None):
- name = getattr(self.fieldName, field)
- assert name is not None
- return MatchExpression(
- name, value,
- matchType = matchType,
- flags = flags,
- )
- return TestService(filePath)
-
-
-
class DirectoryServiceTest(BaseTest, test_directory.DirectoryServiceTest):
def test_repr(self):
service = self.service()
@@ -817,3 +801,24 @@
"__twisted__",
))
)
+
+
+
+def xmlService(tmp, xmlData=None):
+ if xmlData is None:
+ xmlData = testXMLConfig
+
+ filePath = FilePath(tmp)
+ filePath.setContent(xmlData)
+
+ class TestService(DirectoryService):
+ def query(self, field, value, matchType=MatchType.equals, flags=None):
+ name = getattr(self.fieldName, field)
+ assert name is not None
+ return MatchExpression(
+ name, value,
+ matchType = matchType,
+ flags = flags,
+ )
+
+ return TestService(filePath)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130221/7b036d23/attachment.html>
More information about the calendarserver-changes
mailing list