[CalendarServer-changes] [13153] CalendarServer/branches/users/sagen/move2who-4/txdav/who
source_changes at macosforge.org
source_changes at macosforge.org
Thu Apr 3 19:40:16 PDT 2014
Revision: 13153
http://trac.calendarserver.org//changeset/13153
Author: sagen at apple.com
Date: 2014-04-03 19:40:16 -0700 (Thu, 03 Apr 2014)
Log Message:
-----------
Fix augmented record groups( ) and add a test
Modified Paths:
--------------
CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py
Added Paths:
-----------
CalendarServer/branches/users/sagen/move2who-4/txdav/who/test/test_augment.py
Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py 2014-04-04 01:36:35 UTC (rev 13152)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py 2014-04-04 02:40:16 UTC (rev 13153)
@@ -402,8 +402,8 @@
groupUIDs = yield txn.groupsFor(self.uid)
for groupUID in groupUIDs:
- groupRecord = yield self.service.recordWithShortName(
- RecordType.group, groupUID
+ groupRecord = yield self.service.recordWithUID(
+ groupUID
)
if groupRecord:
augmented.append((yield self.service._augment(groupRecord)))
Added: CalendarServer/branches/users/sagen/move2who-4/txdav/who/test/test_augment.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/who/test/test_augment.py (rev 0)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/who/test/test_augment.py 2014-04-04 02:40:16 UTC (rev 13153)
@@ -0,0 +1,62 @@
+##
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+Augment service tests
+"""
+
+from twisted.internet.defer import inlineCallbacks
+from twistedcaldav.test.util import StoreTestCase
+from txdav.who.groups import GroupCacher
+
+
+class AugmentTest(StoreTestCase):
+
+ @inlineCallbacks
+ def setUp(self):
+ yield super(AugmentTest, self).setUp()
+ self.groupCacher = GroupCacher(self.directory)
+
+
+ @inlineCallbacks
+ def test_groups(self):
+ """
+ Make sure augmented record groups( ) returns only the groups that have
+ been refreshed.
+ """
+
+ store = self.storeUnderTest()
+
+ txn = store.newTransaction()
+ yield self.groupCacher.refreshGroup(txn, u"__top_group_1__")
+ yield txn.commit()
+ record = yield self.directory.recordWithUID(u"__sagen1__")
+ groups = yield record.groups()
+ self.assertEquals(
+ set(["__top_group_1__"]),
+ set([g.uid for g in groups])
+ )
+
+ txn = store.newTransaction()
+ yield self.groupCacher.refreshGroup(txn, u"__sub_group_1__")
+ yield txn.commit()
+
+ record = yield self.directory.recordWithUID(u"__sagen1__")
+ groups = yield record.groups()
+ self.assertEquals(
+ set(["__top_group_1__", "__sub_group_1__"]),
+ set([g.uid for g in groups])
+ )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140403/908b654d/attachment-0001.html>
More information about the calendarserver-changes
mailing list