Revision: 6452 http://trac.macosforge.org/projects/calendarserver/changeset/6452 Author: sagen@apple.com Date: 2010-10-22 09:39:48 -0700 (Fri, 22 Oct 2010) Log Message: ----------- Remove xmpp- properties from addressbook home (push-aware AB clients will use push-transports) Modified Paths: -------------- CalendarServer/trunk/twistedcaldav/resource.py CalendarServer/trunk/twistedcaldav/test/test_resource.py Modified: CalendarServer/trunk/twistedcaldav/resource.py =================================================================== --- CalendarServer/trunk/twistedcaldav/resource.py 2010-10-21 20:21:50 UTC (rev 6451) +++ CalendarServer/trunk/twistedcaldav/resource.py 2010-10-22 16:39:48 UTC (rev 6452) @@ -2010,13 +2010,10 @@ pass def liveProperties(self): - + return super(CommonHomeResource, self).liveProperties() + ( (customxml.calendarserver_namespace, "push-transports"), (customxml.calendarserver_namespace, "pushkey"), - (customxml.calendarserver_namespace, "xmpp-uri"), - (customxml.calendarserver_namespace, "xmpp-heartbeat-uri"), - (customxml.calendarserver_namespace, "xmpp-server"), ) def sharesDB(self): @@ -2484,7 +2481,14 @@ returnValue((changed, deleted, notallowed)) + def liveProperties(self): + return super(CalendarHomeResource, self).liveProperties() + ( + (customxml.calendarserver_namespace, "xmpp-uri"), + (customxml.calendarserver_namespace, "xmpp-heartbeat-uri"), + (customxml.calendarserver_namespace, "xmpp-server"), + ) + class AddressBookHomeResource (CommonHomeResource): """ Address book home collection resource. Modified: CalendarServer/trunk/twistedcaldav/test/test_resource.py =================================================================== --- CalendarServer/trunk/twistedcaldav/test/test_resource.py 2010-10-21 20:21:50 UTC (rev 6451) +++ CalendarServer/trunk/twistedcaldav/test/test_resource.py 2010-10-22 16:39:48 UTC (rev 6452) @@ -14,7 +14,7 @@ # limitations under the License. ## -from twistedcaldav.resource import CalDAVResource +from twistedcaldav.resource import CalDAVResource, CommonHomeResource, CalendarHomeResource, AddressBookHomeResource from twistedcaldav.test.util import InMemoryPropertyStore from twistedcaldav.test.util import TestCase @@ -24,7 +24,11 @@ def qname(self): return "StubQnamespace", "StubQname" +class StubHome(object): + def properties(self): + return [] + class CalDAVResourceTests(TestCase): def setUp(self): TestCase.setUp(self) @@ -36,3 +40,26 @@ self.resource.writeDeadProperty(prop) self.assertEquals(self.resource._dead_properties.get(("StubQnamespace", "StubQname")), prop) + +class CommonHomeResourceTests(TestCase): + + def test_commonHomeliveProperties(self): + resource = CommonHomeResource(None, None, None, StubHome()) + self.assertTrue(('http://calendarserver.org/ns/', 'push-transports') in resource.liveProperties()) + self.assertTrue(('http://calendarserver.org/ns/', 'pushkey') in resource.liveProperties()) + + def test_calendarHomeliveProperties(self): + resource = CalendarHomeResource(None, None, None, StubHome()) + self.assertTrue(('http://calendarserver.org/ns/', 'push-transports') in resource.liveProperties()) + self.assertTrue(('http://calendarserver.org/ns/', 'pushkey') in resource.liveProperties()) + self.assertTrue(('http://calendarserver.org/ns/', 'xmpp-uri') in resource.liveProperties()) + self.assertTrue(('http://calendarserver.org/ns/', 'xmpp-heartbeat-uri') in resource.liveProperties()) + self.assertTrue(('http://calendarserver.org/ns/', 'xmpp-server') in resource.liveProperties()) + + def test_addressBookHomeliveProperties(self): + resource = AddressBookHomeResource(None, None, None, StubHome()) + self.assertTrue(('http://calendarserver.org/ns/', 'push-transports') in resource.liveProperties()) + self.assertTrue(('http://calendarserver.org/ns/', 'pushkey') in resource.liveProperties()) + self.assertTrue(('http://calendarserver.org/ns/', 'xmpp-uri') not in resource.liveProperties()) + self.assertTrue(('http://calendarserver.org/ns/', 'xmpp-heartbeat-uri') not in resource.liveProperties()) + self.assertTrue(('http://calendarserver.org/ns/', 'xmpp-server') not in resource.liveProperties())