<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[13305] CalendarServer/trunk/txdav</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/13305">13305</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2014-04-17 08:24:49 -0700 (Thu, 17 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix some issues with group expansion.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunktxdavcaldavdatastoretestcommonpy">CalendarServer/trunk/txdav/caldav/datastore/test/common.py</a></li>
<li><a href="#CalendarServertrunktxdavcarddavdatastoretestcommonpy">CalendarServer/trunk/txdav/carddav/datastore/test/common.py</a></li>
<li><a href="#CalendarServertrunktxdavcarddavdatastoretesttest_sqlpy">CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastoretestutilpy">CalendarServer/trunk/txdav/common/datastore/test/util.py</a></li>
<li><a href="#CalendarServertrunktxdavwhogroupspy">CalendarServer/trunk/txdav/who/groups.py</a></li>
<li><a href="#CalendarServertrunktxdavwhotesttest_group_attendeespy">CalendarServer/trunk/txdav/who/test/test_group_attendees.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunktxdavcaldavdatastoretestcommonpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/test/common.py (13304 => 13305)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/test/common.py        2014-04-17 00:26:27 UTC (rev 13304)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/common.py        2014-04-17 15:24:49 UTC (rev 13305)
</span><span class="lines">@@ -252,7 +252,6 @@
</span><span class="cx">             &quot;calendar_empty&quot;: {},
</span><span class="cx">             &quot;not_a_calendar&quot;: None
</span><span class="cx">         },
</span><del>-        &quot;not_a_home&quot;: None,
</del><span class="cx">         &quot;home_splits&quot;: {
</span><span class="cx">             &quot;calendar_1&quot;: {
</span><span class="cx">                 &quot;1.ics&quot;: (cal1SplitsRoot.child(&quot;1.ics&quot;).getContent(), metadata1),
</span><span class="lines">@@ -297,7 +296,6 @@
</span><span class="cx">             &quot;calendar_empty&quot;: {},
</span><span class="cx">             &quot;not_a_calendar&quot;: None
</span><span class="cx">         },
</span><del>-        &quot;not_a_home&quot;: None,
</del><span class="cx">         &quot;home_splits&quot;: {
</span><span class="cx">             &quot;calendar_1&quot;: {
</span><span class="cx">                 &quot;1.ics&quot;: md5Values[0],
</span></span></pre></div>
<a id="CalendarServertrunktxdavcarddavdatastoretestcommonpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/carddav/datastore/test/common.py (13304 => 13305)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/carddav/datastore/test/common.py        2014-04-17 00:26:27 UTC (rev 13304)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/common.py        2014-04-17 15:24:49 UTC (rev 13305)
</span><span class="lines">@@ -170,7 +170,6 @@
</span><span class="cx">                 &quot;6.vcf&quot;: adbk3Root.child(&quot;6.vcf&quot;).getContent(),
</span><span class="cx">             },
</span><span class="cx">         },
</span><del>-        &quot;not_a_home&quot;: None
</del><span class="cx">     }
</span><span class="cx">     md5s = {
</span><span class="cx">         &quot;home1&quot;: {
</span><span class="lines">@@ -200,7 +199,6 @@
</span><span class="cx">                 &quot;6.vcf&quot;: md5Values[5],
</span><span class="cx">             },
</span><span class="cx">         },
</span><del>-        &quot;not_a_home&quot;: None
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     def storeUnderTest(self):
</span></span></pre></div>
<a id="CalendarServertrunktxdavcarddavdatastoretesttest_sqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py (13304 => 13305)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py        2014-04-17 00:26:27 UTC (rev 13304)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py        2014-04-17 15:24:49 UTC (rev 13305)
</span><span class="lines">@@ -80,8 +80,8 @@
</span><span class="cx">         populateTxn = self.storeUnderTest().newTransaction()
</span><span class="cx">         for homeUID in self.requirements:
</span><span class="cx">             addressbooks = self.requirements[homeUID]
</span><ins>+            home = yield populateTxn.addressbookHomeWithUID(homeUID, True)
</ins><span class="cx">             if addressbooks is not None:
</span><del>-                home = yield populateTxn.addressbookHomeWithUID(homeUID, True)
</del><span class="cx">                 addressbook = home.addressbook()
</span><span class="cx"> 
</span><span class="cx">                 addressbookObjNames = addressbooks[addressbook.name()]
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastoretestutilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/test/util.py (13304 => 13305)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/test/util.py        2014-04-17 00:26:27 UTC (rev 13304)
+++ CalendarServer/trunk/txdav/common/datastore/test/util.py        2014-04-17 15:24:49 UTC (rev 13305)
</span><span class="lines">@@ -488,8 +488,8 @@
</span><span class="cx">         populateTxn._migrating = True
</span><span class="cx">     for homeUID in requirements:
</span><span class="cx">         calendars = requirements[homeUID]
</span><ins>+        home = yield populateTxn.calendarHomeWithUID(homeUID, True)
</ins><span class="cx">         if calendars is not None:
</span><del>-            home = yield populateTxn.calendarHomeWithUID(homeUID, True)
</del><span class="cx">             # We don't want the default calendar or inbox to appear unless it's
</span><span class="cx">             # explicitly listed.
</span><span class="cx">             try:
</span><span class="lines">@@ -516,6 +516,7 @@
</span><span class="cx">                             internal_state=ComponentUpdateState.RAW,
</span><span class="cx">                             options=metadata,
</span><span class="cx">                         )
</span><ins>+
</ins><span class="cx">     yield populateTxn.commit()
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhogroupspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/groups.py (13304 => 13305)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/groups.py        2014-04-17 00:26:27 UTC (rev 13304)
+++ CalendarServer/trunk/txdav/who/groups.py        2014-04-17 15:24:49 UTC (rev 13305)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx"> from twext.enterprise.jobqueue import WorkItem, PeerConnectionPool
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, returnValue
</span><span class="cx"> from txdav.common.datastore.sql_tables import schema
</span><del>-from txdav.caldav.datastore.sql import Calendar
</del><ins>+from txdav.caldav.datastore.sql import CalendarStoreFeatures
</ins><span class="cx"> import datetime
</span><span class="cx"> import hashlib
</span><span class="cx"> 
</span><span class="lines">@@ -175,26 +175,14 @@
</span><span class="cx">             )
</span><span class="cx">         ).on(self.transaction)
</span><span class="cx"> 
</span><del>-        # get calendar id
-        co = schema.CALENDAR_OBJECT
-        rows = yield Select(
-                [co.CALENDAR_RESOURCE_ID, ],
-                From=co,
-                Where=co.RESOURCE_ID == self.resourceID,
-        ).on(self.transaction)
-        calendarID = rows[0][0]
</del><ins>+        # get db object
+        calendarObject = (yield CalendarStoreFeatures(self.transaction._store).calendarObjectWithID(self.transaction, self.resourceID))
+        component = yield calendarObject.componentForUser()
</ins><span class="cx"> 
</span><del>-        # get home id
-        calendarHomeID = (yield Calendar._ownerHomeWithResourceID.on(
-            self.transaction, resourceID=calendarID)
-        )[0][0]
</del><ins>+        # Change a copy of the original, as we need the original cached on the resource
+        # so we can do a diff to test implicit scheduling changes
+        component = component.duplicate()
</ins><span class="cx"> 
</span><del>-        # get db objects
-        calendarHome = yield self.transaction.calendarHomeWithResourceID(calendarHomeID)
-        calendar = yield calendarHome.childWithID(calendarID)
-        calendarObject = yield calendar.objectResourceWithID(self.resourceID)
-        component = yield calendarObject.component()
-
</del><span class="cx">         # TODO: Check performance because:
</span><span class="cx">         #    1) if the component is changed then expandGroupAttendee() will be called again to validate
</span><span class="cx">         #    2) The group and members are in the group cache so could use them here
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhotesttest_group_attendeespy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/test/test_group_attendees.py (13304 => 13305)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/test/test_group_attendees.py        2014-04-17 00:26:27 UTC (rev 13304)
+++ CalendarServer/trunk/txdav/who/test/test_group_attendees.py        2014-04-17 15:24:49 UTC (rev 13305)
</span><span class="lines">@@ -70,15 +70,23 @@
</span><span class="cx">         self.notifierFactory.reset()
</span><span class="cx"> 
</span><span class="cx">     requirements = {
</span><del>-        &quot;10000000-0000-0000-0000-000000000001&quot; : {
-            &quot;calendar&quot; : {}
-        },
-        &quot;10000000-0000-0000-0000-000000000002&quot; : {
-            &quot;calendar&quot; : {}
-        },
</del><ins>+        &quot;10000000-0000-0000-0000-000000000001&quot; : None,
+        &quot;10000000-0000-0000-0000-000000000002&quot; : None,
+        &quot;10000000-0000-0000-0000-000000000006&quot; : None,
+        &quot;10000000-0000-0000-0000-000000000007&quot; : None,
+        &quot;10000000-0000-0000-0000-000000000008&quot; : None,
+        &quot;10000000-0000-0000-0000-000000000009&quot; : None,
+        &quot;10000000-0000-0000-0000-000000000010&quot; : None,
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><ins>+    def _verifyObjectResourceCount(self, home, expected_count):
+        cal6 = yield self.calendarUnderTest(name=&quot;calendar&quot;, home=home)
+        count = yield cal6.countObjectResources()
+        self.assertEqual(count, expected_count)
+
+
+    @inlineCallbacks
</ins><span class="cx">     def test_simplePUT(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Test that group attendee is expanded on PUT
</span><span class="lines">@@ -121,6 +129,9 @@
</span><span class="cx"> END:VCALENDAR
</span><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> 
</span><ins>+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000006&quot;, 0)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000007&quot;, 0)
+
</ins><span class="cx">         vcalendar1 = Component.fromString(data_put_1)
</span><span class="cx">         yield calendar.createCalendarObjectWithName(&quot;data1.ics&quot;, vcalendar1)
</span><span class="cx">         yield self.commit()
</span><span class="lines">@@ -129,7 +140,10 @@
</span><span class="cx">         vcalendar2 = yield cobj1.component()
</span><span class="cx">         self.assertEqual(normalize_iCalStr(vcalendar2), normalize_iCalStr(data_get_1))
</span><span class="cx"> 
</span><ins>+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000006&quot;, 1)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000007&quot;, 1)
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx">     @inlineCallbacks
</span><span class="cx">     def test_unknownPUT(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="lines">@@ -236,6 +250,12 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Test that nested groups are expanded expanded on PUT
</span><span class="cx">         &quot;&quot;&quot;
</span><ins>+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000006&quot;, 0)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000007&quot;, 0)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000008&quot;, 0)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000009&quot;, 0)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000010&quot;, 0)
+
</ins><span class="cx">         calendar = yield self.calendarUnderTest(name=&quot;calendar&quot;, home=&quot;10000000-0000-0000-0000-000000000001&quot;)
</span><span class="cx"> 
</span><span class="cx">         data_put_1 = &quot;&quot;&quot;BEGIN:VCALENDAR
</span><span class="lines">@@ -285,12 +305,23 @@
</span><span class="cx">         vcalendar2 = yield cobj1.component()
</span><span class="cx">         self.assertEqual(normalize_iCalStr(vcalendar2), normalize_iCalStr(data_get_1))
</span><span class="cx"> 
</span><ins>+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000006&quot;, 1)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000007&quot;, 1)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000008&quot;, 1)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000009&quot;, 1)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000010&quot;, 1)
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx">     @inlineCallbacks
</span><span class="cx">     def test_multiGroupPUT(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Test that expanded users in two primary groups have groups in MEMBERS param
</span><span class="cx">         &quot;&quot;&quot;
</span><ins>+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000006&quot;, 0)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000007&quot;, 0)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000008&quot;, 0)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000009&quot;, 0)
+
</ins><span class="cx">         calendar = yield self.calendarUnderTest(name=&quot;calendar&quot;, home=&quot;10000000-0000-0000-0000-000000000001&quot;)
</span><span class="cx"> 
</span><span class="cx">         data_put_1 = &quot;&quot;&quot;BEGIN:VCALENDAR
</span><span class="lines">@@ -343,11 +374,16 @@
</span><span class="cx">         vcalendar2 = yield cobj1.component()
</span><span class="cx">         self.assertEqual(normalize_iCalStr(vcalendar2), normalize_iCalStr(data_get_1))
</span><span class="cx"> 
</span><ins>+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000006&quot;, 1)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000007&quot;, 1)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000008&quot;, 1)
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000009&quot;, 1)
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx">     @inlineCallbacks
</span><span class="cx">     def test_groupChange(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        Test that group attendee is expanded on PUT
</del><ins>+        Test that group attendee changes are applied to existing resources.
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         data_put_1 = &quot;&quot;&quot;BEGIN:VCALENDAR
</span><span class="cx"> CALSCALE:GREGORIAN
</span><span class="lines">@@ -366,23 +402,6 @@
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR&quot;&quot;&quot;
</span><span class="cx"> 
</span><del>-        data_get_1 = &quot;&quot;&quot;BEGIN:VCALENDAR
-VERSION:2.0
-CALSCALE:GREGORIAN
-PRODID:-//Example Inc.//Example Calendar//EN
-BEGIN:VEVENT
-UID:event1@ninevah.local
-DTSTART;TZID=US/Eastern:20140101T100000
-DURATION:PT1H
-ATTENDEE;CN=User 01;EMAIL=user01@example.com;RSVP=TRUE:urn:uuid:10000000-0000-0000-0000-000000000001
-ATTENDEE;CN=Group 02;CUTYPE=GROUP;EMAIL=group02@example.com;RSVP=TRUE;SCHEDULE-STATUS=3.7:urn:uuid:20000000-0000-0000-0000-000000000002
-CREATED:20060101T150000Z
-ORGANIZER;CN=User 01;EMAIL=user01@example.com:urn:uuid:10000000-0000-0000-0000-000000000001
-SUMMARY:event 1
-END:VEVENT
-END:VCALENDAR
-&quot;&quot;&quot;
-
</del><span class="cx">         data_get_2 = &quot;&quot;&quot;BEGIN:VCALENDAR
</span><span class="cx"> VERSION:2.0
</span><span class="cx"> CALSCALE:GREGORIAN
</span><span class="lines">@@ -410,17 +429,15 @@
</span><span class="cx"> DURATION:PT1H
</span><span class="cx"> ATTENDEE;CN=User 02;EMAIL=user02@example.com;RSVP=TRUE:urn:uuid:10000000-0000-0000-0000-000000000002
</span><span class="cx"> ATTENDEE;CN=Group 01;CUTYPE=GROUP;EMAIL=group01@example.com;RSVP=TRUE;SCHEDULE-STATUS=3.7:urn:uuid:20000000-0000-0000-0000-000000000001
</span><del>-ATTENDEE;CN=User 01;EMAIL=user01@example.com;MEMBER=&quot;urn:uuid:20000000-0000-0000-0000-000000000001&quot;;PARTSTAT=NEEDS-ACTION:urn:uuid:10000000-0000-0000-0000-000000000001
</del><ins>+ATTENDEE;CN=User 01;EMAIL=user01@example.com;MEMBER=&quot;urn:uuid:20000000-0000-0000-0000-000000000001&quot;;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:10000000-0000-0000-0000-000000000001
</ins><span class="cx"> CREATED:20060101T150000Z
</span><span class="cx"> ORGANIZER;CN=User 02;EMAIL=user02@example.com:urn:uuid:10000000-0000-0000-0000-000000000002
</span><ins>+SEQUENCE:1
</ins><span class="cx"> SUMMARY:event 1
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> 
</span><del>-        #TODO: should User 01 have SCHEDULE-STATUS=3.7 ?
-
-
</del><span class="cx">         @inlineCallbacks
</span><span class="cx">         def expandedMembers(self, records=None):
</span><span class="cx">             yield None
</span><span class="lines">@@ -442,6 +459,9 @@
</span><span class="cx">         vcalendar2 = yield cobj1.component()
</span><span class="cx">         self.assertEqual(normalize_iCalStr(vcalendar2), normalize_iCalStr(data_get_2))
</span><span class="cx"> 
</span><ins>+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000001&quot;, 0)
+        yield self.commit()
+
</ins><span class="cx">         self.patch(CalendarDirectoryRecordMixin, &quot;expandedMembers&quot;, unpatchedExpandedMembers)
</span><span class="cx"> 
</span><span class="cx">         groupCacher = GroupCacher(self.transactionUnderTest().directoryService())
</span><span class="lines">@@ -454,3 +474,34 @@
</span><span class="cx">         cobj1 = yield self.calendarObjectUnderTest(name=&quot;data1.ics&quot;, calendar_name=&quot;calendar&quot;, home=&quot;10000000-0000-0000-0000-000000000002&quot;)
</span><span class="cx">         vcalendar3 = yield cobj1.component()
</span><span class="cx">         self.assertEqual(normalize_iCalStr(vcalendar3), normalize_iCalStr(data_get_3))
</span><ins>+
+        yield self._verifyObjectResourceCount(&quot;10000000-0000-0000-0000-000000000001&quot;, 1)
+        yield self.commit()
+
+        self.patch(CalendarDirectoryRecordMixin, &quot;expandedMembers&quot;, expandedMembers)
+        groupCacher = GroupCacher(self.transactionUnderTest().directoryService())
+        wps = yield groupCacher.refreshGroup(self.transactionUnderTest(), &quot;20000000-0000-0000-0000-000000000001&quot;)
+        yield self.commit()
+        self.assertEqual(len(wps), 1)
+        for wp in wps:
+            yield wp.whenExecuted()
+
+        cobj1 = yield self.calendarObjectUnderTest(name=&quot;data1.ics&quot;, calendar_name=&quot;calendar&quot;, home=&quot;10000000-0000-0000-0000-000000000002&quot;)
+        vcalendar3 = yield cobj1.component()
+        self.assertEqual(normalize_iCalStr(vcalendar3), normalize_iCalStr(data_get_2))
+
+        cal1 = yield self.calendarUnderTest(name=&quot;calendar&quot;, home=&quot;10000000-0000-0000-0000-000000000001&quot;)
+        cobjs = yield cal1.objectResources()
+        self.assertEqual(len(cobjs), 1)
+        comp1 = yield cobjs[0].componentForUser()
+        self.assertTrue(&quot;STATUS:CANCELLED&quot; in str(comp1))
+
+
+    @inlineCallbacks
+    def test_groupRemoval(self):
+        &quot;&quot;&quot;
+        Test that removing a group also removes the expanded attendees. This needs to make sure
+        that an attendee in two groups is NOT removed if only one of those groups is removed
+        &quot;&quot;&quot;
+
+        self.fail(&quot;FIXME: implement this test&quot;)
</ins></span></pre>
</div>
</div>

</body>
</html>