<!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>[13758] CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/test/test_sql_sharing.py</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/13758">13758</a></dd>
<dt>Author</dt> <dd>gaya@apple.com</dd>
<dt>Date</dt> <dd>2014-07-15 17:07:13 -0700 (Tue, 15 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>clean</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesusersgayagroupsharee2txdavcaldavdatastoretesttest_sql_sharingpy">CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/test/test_sql_sharing.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesusersgayagroupsharee2txdavcaldavdatastoretesttest_sql_sharingpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/test/test_sql_sharing.py (13757 => 13758)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/test/test_sql_sharing.py        2014-07-15 03:00:34 UTC (rev 13757)
+++ CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/test/test_sql_sharing.py        2014-07-16 00:07:13 UTC (rev 13758)
</span><span class="lines">@@ -588,9 +588,9 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><del>-class GroupSharing(BaseSharingTests):
</del><ins>+class GroupSharingTests(BaseSharingTests):
</ins><span class="cx"> """
</span><del>- Test store-based group book sharing.
</del><ins>+ Test store-based group sharing.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -610,7 +610,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def configure(self):
</span><del>- super(GroupSharing, self).configure()
</del><ins>+ super(GroupSharingTests, self).configure()
</ins><span class="cx"> config.Sharing.Enabled = True
</span><span class="cx"> config.Sharing.Calendars.Enabled = True
</span><span class="cx"> config.Sharing.Calendars.Groups.Enabled = True
</span><span class="lines">@@ -624,6 +624,9 @@
</span><span class="cx"> self.assertEqual(set(notifications), set(items))
</span><span class="cx">
</span><span class="cx">
</span><ins>+
+class GroupSharing(GroupSharingTests):
+
</ins><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_no_shares(self):
</span><span class="cx"> """
</span><span class="lines">@@ -636,9 +639,9 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def test_invite_empty_group(self):
</del><ins>+ def test_invite_owner_group(self):
</ins><span class="cx"> """
</span><del>- Test invite/uninvite creates/removes shares and notifications.
</del><ins>+ Test that inviting group with just owner creates no shares.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> yield self._check_notifications("user01", [])
</span><span class="lines">@@ -678,7 +681,7 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_invite_group(self):
</span><span class="cx"> """
</span><del>- Test invite/uninvite creates/removes shares and notifications.
</del><ins>+ Test invite/uninvite group creates/removes shares and notifications.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -730,9 +733,9 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def test_accept_share(self):
</del><ins>+ def test_accept_group(self):
</ins><span class="cx"> """
</span><del>- Test that invite+accept creates shares and notifications.
</del><ins>+ Test that shares created from group invite are accepted normally
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -785,9 +788,9 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def test_decline_share(self):
</del><ins>+ def test_decline_group(self):
</ins><span class="cx"> """
</span><del>- Test that invite+decline does not create shares but does create notifications.
</del><ins>+ Test that shared from group invite are declined normally.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -842,8 +845,7 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_accept_decline_share(self):
</span><span class="cx"> """
</span><del>- Test that invite+accept/decline creates/removes shares and notifications.
- Decline via the home.
</del><ins>+ Test that shares from group invite are accepted and declined normally.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -896,10 +898,9 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def test_accept_remove_share(self):
</del><ins>+ def test_accept_remove_group(self):
</ins><span class="cx"> """
</span><del>- Test that invite+accept/decline creates/removes shares and notifications.
- Decline via the shared collection (removal).
</del><ins>+ Test that shares from group invite are accepted then removed normally.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -954,8 +955,7 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_accept_uninvite_group(self):
</span><span class="cx"> """
</span><del>- Test that invite+accept/decline creates/removes shares and notifications.
- Decline via the shared collection (removal).
</del><ins>+ Test group invite then accepted shared can be group uninvited
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -1017,7 +1017,7 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_accept_two_groups(self):
</span><span class="cx"> """
</span><del>- Test that accept of two groups works.
</del><ins>+ Test invite/accept of two groups.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -1066,7 +1066,7 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_accept_uninvite_two_groups(self):
</span><span class="cx"> """
</span><del>- Test that accept of two groups works, then uninvite each one.
</del><ins>+ Test 2 group invite, accept, 2 group uninvite.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -1142,7 +1142,8 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_accept_uninvite_two_groups_different_access(self):
</span><span class="cx"> """
</span><del>- Test that accept of two groups works, then uninvite each one.
</del><ins>+ Test 2 group invite, accept, 2 group uninvite when group have different
+ access.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -1215,10 +1216,17 @@
</span><span class="cx"> self.assertEqual((yield self.calendarUnderTest(home=invite.shareeUID, name=invite.uid)), None)
</span><span class="cx">
</span><span class="cx">
</span><ins>+
+class MixedSharing(GroupSharingTests):
+ """
+ Test store-based combined individual and group sharing.
+ """
+
</ins><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_accept_uninvite_individual_and_group(self):
</span><span class="cx"> """
</span><del>- Test that accept of two groups works, then uninvite each one.
</del><ins>+ Test individual invite + group containing individual invite, accept,
+ then uninvite individual, group.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -1292,7 +1300,7 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_accept_uninvite_group_and_individual(self):
</span><span class="cx"> """
</span><del>- Test that accept of two groups works, then uninvite each one.
</del><ins>+ Test group + individual contained in group invite, accept, then uninvite group, individual.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -1370,7 +1378,7 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_accept_uninvite_individual_and_groups(self):
</span><span class="cx"> """
</span><del>- Test that accept of two groups works, then uninvite each one.
</del><ins>+ Test individual invite + 2 group containing individual invite, accept, then uninvite individual, groups.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -1464,7 +1472,9 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_accept_uninvite_individual_and_groups_different_access(self):
</span><span class="cx"> """
</span><del>- Test that accept of two groups works, then uninvite each one.
</del><ins>+ Test individual invite + 2 group containing individual invite, accept,
+ then uninvite individual, groups when individual and groups have
+ different access.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> # Invite
</span><span class="lines">@@ -1586,155 +1596,9 @@
</span><span class="cx"> for invite in invites:
</span><span class="cx"> self.assertEqual((yield self.calendarUnderTest(home=invite.shareeUID, name=invite.uid)), None)
</span><span class="cx">
</span><del>- '''
- @inlineCallbacks
- def test_accept_decline_two_groups(self):
- """
- Test that accept of two groups works, then decline each one.
- """
</del><span class="cx">
</span><del>- # Two shares
- inviteUID1 = yield self._createGroupShare(groupname="group1.vcf")
- inviteUID2 = yield self._createGroupShare(groupname="group2.vcf")
</del><span class="cx">
</span><del>- yield self._check_calendar("user02", "user01", self.all_children)
- yield self._check_notifications("user01", [inviteUID1 + "-reply", inviteUID2 + "-reply", ])
</del><span class="cx">
</span><del>- yield self.commit()
-
- # Decline one
- shareeHome = yield self.homeUnderTest(name="user02")
- yield shareeHome.declineShare(inviteUID1)
-
- yield self._check_calendar("user02", "user01", self.group2_children)
-
- shared = yield self.calendarObjectUnderTest(home="user02", calendar_name="user01", name="group1.vcf")
- self.assertTrue(shared is None)
- shared = yield self.calendarObjectUnderTest(home="user02", calendar_name="user01", name="card2.vcf")
- self.assertTrue(shared is None)
-
- yield self.commit()
-
- # Decline other
- shareeHome = yield self.homeUnderTest(name="user02")
- yield shareeHome.declineShare(inviteUID2)
-
- sharedParent = yield self.calendarUnderTest(home="user02", name="user01")
- self.assertTrue(sharedParent is None)
-
-
- @inlineCallbacks
- def test_accept_two_groups_different_access(self):
- """
- Test that accept of two groups works, then uninvite each one.
- """
-
- # Two shares
- inviteUID1 = yield self._createGroupShare(groupname="group1.vcf")
- inviteUID2 = yield self._createGroupShare(groupname="group2.vcf", mode=_BIND_MODE_WRITE)
-
- yield self._check_calendar("user02", "user01", self.all_children)
- yield self._check_notifications("user01", [inviteUID1 + "-reply", inviteUID2 + "-reply", ])
-
- # Read only for all, write for group2's items
- yield self._check_read_only("user02", "user01", ["group1.vcf", "card2.vcf", ])
- yield self._check_read_write("user02", "user01", ["group2.vcf", "card1.vcf", "card3.vcf", ])
-
- yield self.commit()
-
- # Decline one
- shareeHome = yield self.homeUnderTest(name="user02")
- yield shareeHome.declineShare(inviteUID2)
-
- yield self._check_calendar("user02", "user01", self.group1_children)
-
- yield self._check_read_only("user02", "user01", ["group1.vcf", "card1.vcf", "card2.vcf", ])
-
- shared = yield self.calendarObjectUnderTest(home="user02", calendar_name="user01", name="group2.vcf")
- self.assertTrue(shared is None)
- shared = yield self.calendarObjectUnderTest(home="user02", calendar_name="user01", name="card3.vcf")
- self.assertTrue(shared is None)
-
- yield self.commit()
-
- # Decline other
- shareeHome = yield self.homeUnderTest(name="user02")
- yield shareeHome.declineShare(inviteUID1)
-
- sharedParent = yield self.calendarUnderTest(home="user02", name="user01")
- self.assertTrue(sharedParent is None)
- '''
-
-'''
-class MixedSharing(BaseSharingTests):
- """
- Test store-based combined address book and group book sharing.
- """
-
- @inlineCallbacks
- def test_calendar_ro_then_groups(self):
-
- # Share address book read-only
- shareeName = yield self._createShare()
- yield self._check_calendar("user02", "user01", self.fully_shared_children)
- yield self._check_read_only("user02", "user01", self.all_children)
- yield self._check_read_write("user02", "user01", [])
- yield self._check_notifications("user02", [shareeName, ])
-
- # Add group1 read-write
- inviteUID1 = yield self._createGroupShare(groupname="group1.vcf", mode=_BIND_MODE_WRITE)
-
- yield self._check_calendar("user02", "user01", self.fully_shared_children)
- yield self._check_read_only("user02", "user01", ["group2.vcf", "card3.vcf", ])
- yield self._check_read_write("user02", "user01", ["group1.vcf", "card1.vcf", "card2.vcf", ])
- yield self._check_notifications("user02", [shareeName, inviteUID1, ])
-
- # Add group2 read-write
- inviteUID2 = yield self._createGroupShare(groupname="group2.vcf", mode=_BIND_MODE_WRITE)
-
- yield self._check_calendar("user02", "user01", self.fully_shared_children)
- yield self._check_read_only("user02", "user01", [])
- yield self._check_read_write("user02", "user01", self.all_children)
- yield self._check_notifications("user02", [shareeName, inviteUID1, inviteUID2])
-
- # Uninvite group1
- group = yield self.calendarObjectUnderTest(home="user01", calendar_name="calendar", name="group1.vcf")
- yield group.uninviteUIDFromShare("user02")
-
- yield self._check_calendar("user02", "user01", self.fully_shared_children)
- yield self._check_read_only("user02", "user01", ["group1.vcf", "card2.vcf", ])
- yield self._check_read_write("user02", "user01", ["group2.vcf", "card1.vcf", "card3.vcf", ])
-
- # Uninvite group2
- group = yield self.calendarObjectUnderTest(home="user01", calendar_name="calendar", name="group2.vcf")
- yield group.uninviteUIDFromShare("user02")
-
- yield self._check_calendar("user02", "user01", self.fully_shared_children)
- yield self._check_read_only("user02", "user01", self.all_children)
- yield self._check_read_write("user02", "user01", [])
-
-
- @inlineCallbacks
- def test_calendar_ro_then_group_no_accept(self):
-
- # Share address book read-only
- shareeName = yield self._createShare()
- yield self._check_calendar("user02", "user01", self.fully_shared_children)
- yield self._check_read_only("user02", "user01", self.all_children)
- yield self._check_read_write("user02", "user01", [])
- yield self._check_notifications("user02", [shareeName, ])
-
- # Add group1 read-write - but do not accept
- group = yield self.calendarObjectUnderTest(home="user01", calendar_name="calendar", name="group1.vcf")
- invited = yield group.inviteUIDToShare("user02", _BIND_MODE_WRITE, "summary")
- yield self._check_notifications("user02", [shareeName, invited.shareUID(), ])
-
- yield self._check_calendar("user02", "user01", self.fully_shared_children)
- yield self._check_read_only("user02", "user01", self.all_children)
- yield self._check_read_write("user02", "user01", [])
-
-
-
</del><span class="cx"> class SharingRevisions(BaseSharingTests):
</span><span class="cx"> """
</span><span class="cx"> Test store-based sharing and interaction with revision table.
</span><span class="lines">@@ -1827,4 +1691,3 @@
</span><span class="cx"> self.assertEqual(len(changed), 0)
</span><span class="cx"> self.assertEqual(len(deleted), 0)
</span><span class="cx"> self.assertEqual(len(invalid), 0)
</span><del>-'''
</del></span></pre>
</div>
</div>
</body>
</html>