<!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>[15408] CalendarServer/trunk</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/15408">15408</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2015-12-19 07:01:41 -0800 (Sat, 19 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fake email address for resources and locations.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunkconfcaldavdstdconfigplist">CalendarServer/trunk/conf/caldavd-stdconfig.plist</a></li>
<li><a href="#CalendarServertrunktwistedcaldavicalpy">CalendarServer/trunk/twistedcaldav/ical.py</a></li>
<li><a href="#CalendarServertrunktwistedcaldavstdconfigpy">CalendarServer/trunk/twistedcaldav/stdconfig.py</a></li>
<li><a href="#CalendarServertrunktwistedcaldavtesttest_icalendarpy">CalendarServer/trunk/twistedcaldav/test/test_icalendar.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastoretestaccountsresourcesxml">CalendarServer/trunk/txdav/common/datastore/test/accounts/resources.xml</a></li>
<li><a href="#CalendarServertrunktxdavwhoaugmentpy">CalendarServer/trunk/txdav/who/augment.py</a></li>
<li><a href="#CalendarServertrunktxdavwhodirectorypy">CalendarServer/trunk/txdav/who/directory.py</a></li>
<li><a href="#CalendarServertrunktxdavwhotesttest_directorypy">CalendarServer/trunk/txdav/who/test/test_directory.py</a></li>
<li><a href="#CalendarServertrunktxdavwhowikipy">CalendarServer/trunk/txdav/who/wiki.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunkconfcaldavdstdconfigplist"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/conf/caldavd-stdconfig.plist (15407 => 15408)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/conf/caldavd-stdconfig.plist        2015-12-19 03:26:23 UTC (rev 15407)
+++ CalendarServer/trunk/conf/caldavd-stdconfig.plist        2015-12-19 15:01:41 UTC (rev 15408)
</span><span class="lines">@@ -1420,6 +1420,10 @@
</span><span class="cx">                         &lt;key&gt;TrackUnscheduledResourceData&lt;/key&gt;
</span><span class="cx">                         &lt;true/&gt;
</span><span class="cx"> 
</span><ins>+                        &lt;!-- Add fake email addresses to work around client bug --&gt;
+                        &lt;key&gt;FakeResourceLocationEmail&lt;/key&gt;
+                        &lt;false/&gt;
+
</ins><span class="cx">                         &lt;!-- Maximum number of attendees to request freebusy for --&gt;
</span><span class="cx">                         &lt;key&gt;LimitFreeBusyAttendees&lt;/key&gt;
</span><span class="cx">                         &lt;integer&gt;30&lt;/integer&gt;
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavicalpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/ical.py (15407 => 15408)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/ical.py        2015-12-19 03:26:23 UTC (rev 15407)
+++ CalendarServer/trunk/twistedcaldav/ical.py        2015-12-19 15:01:41 UTC (rev 15408)
</span><span class="lines">@@ -3510,6 +3510,10 @@
</span><span class="cx">                 if oldemail:
</span><span class="cx">                     oldemail = &quot;mailto:{0}&quot;.format(oldemail,)
</span><span class="cx"> 
</span><ins>+                    if config.Scheduling.Options.FakeResourceLocationEmail:
+                        if oldemail.endswith(&quot;@do_not_reply&quot;):
+                            oldemail = None
+
</ins><span class="cx">                 # Get any CN parameter
</span><span class="cx">                 oldCN = prop.parameterValue(&quot;CN&quot;)
</span><span class="cx"> 
</span><span class="lines">@@ -3583,6 +3587,10 @@
</span><span class="cx">                         else:
</span><span class="cx">                             email = None
</span><span class="cx"> 
</span><ins>+                    if config.Scheduling.Options.FakeResourceLocationEmail:
+                        if email and email.endswith(&quot;@do_not_reply&quot;):
+                            email = &quot;&quot;
+
</ins><span class="cx">                     if email:
</span><span class="cx">                         prop.setParameter(&quot;EMAIL&quot;, email)
</span><span class="cx">                     else:
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavstdconfigpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py (15407 => 15408)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/stdconfig.py        2015-12-19 03:26:23 UTC (rev 15407)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py        2015-12-19 15:01:41 UTC (rev 15408)
</span><span class="lines">@@ -767,6 +767,7 @@
</span><span class="cx">             &quot;AllowResourceWithoutOrganizer&quot;       : True, # Allow resources to have events without an Organizer
</span><span class="cx">             &quot;TrackUnscheduledLocationData&quot;        : True, # Track who the last modifier of an unscheduled location event is
</span><span class="cx">             &quot;TrackUnscheduledResourceData&quot;        : True, # Track who the last modifier of an unscheduled resource event is
</span><ins>+            &quot;FakeResourceLocationEmail&quot;           : False, # Add fake email addresses to work around client bug
</ins><span class="cx">             &quot;LimitFreeBusyAttendees&quot;              : 30, # Maximum number of attendees to request freebusy for
</span><span class="cx">             &quot;AttendeeRefreshBatch&quot;                : 5, # Number of attendees to do batched refreshes: 0 - no batching
</span><span class="cx">             &quot;AttendeeRefreshCountLimit&quot;           : 50, # Number of attendees above which attendee refreshes are suppressed: 0 - no limit
</span><span class="lines">@@ -1768,6 +1769,7 @@
</span><span class="cx"> )
</span><span class="cx"> POST_UPDATE_HOOKS = (
</span><span class="cx">     _updateMultiProcess,
</span><ins>+    _updateUtilityLog,  # Must be before _updateDataStore for proper relative path
</ins><span class="cx">     _updateDataStore,
</span><span class="cx">     _updateHostName,
</span><span class="cx">     _updateWorkQueue,
</span><span class="lines">@@ -1777,7 +1779,6 @@
</span><span class="cx">     _updateACLs,
</span><span class="cx">     _updateRejectClients,
</span><span class="cx">     _updateClientFixes,
</span><del>-    _updateUtilityLog,
</del><span class="cx">     _updateLogLevels,
</span><span class="cx">     _updateNotifications,
</span><span class="cx">     _updateICalendar,
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavtesttest_icalendarpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/test/test_icalendar.py (15407 => 15408)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/test/test_icalendar.py        2015-12-19 03:26:23 UTC (rev 15407)
+++ CalendarServer/trunk/twistedcaldav/test/test_icalendar.py        2015-12-19 15:01:41 UTC (rev 15408)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> from twisted.trial.unittest import SkipTest
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, succeed
</span><span class="cx"> 
</span><ins>+from twistedcaldav.config import config
</ins><span class="cx"> from twistedcaldav.dateops import normalizeForExpand
</span><span class="cx"> from twistedcaldav.ical import Component, Property, InvalidICalendarDataError, \
</span><span class="cx">     normalizeCUAddress, normalize_iCalStr, diff_iCalStrs
</span><span class="lines">@@ -8434,6 +8435,73 @@
</span><span class="cx">         self.assertEquals(prop.parameterValue(&quot;CN&quot;), &quot;{Restricted} Buzz&quot;)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    def test_normalizeCalendarUserAddressesWithFakeEmail(self):
+        &quot;&quot;&quot;
+        Ensure fake email addresses are not inserted as EMAIL parameters.
+        &quot;&quot;&quot;
+
+        self.patch(config.Scheduling.Options, &quot;FakeResourceLocationEmail&quot;, True)
+
+        data = &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+DTSTART:20071114T000000Z
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20071114T000000Z
+ATTENDEE:/principals/users/foo
+ATTENDEE;CN=Fake 1;CUTYPE=ROOM:mailto:fake1@do_not_reply
+ATTENDEE;CN=Fake 2;CUTYPE=ROOM;EMAIL=fake2@do_not_reply:mailto:fake2@do_not_reply
+LOCATION:Buzz
+DTSTAMP:20071114T000000Z
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;
+
+        result = &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+DTSTART:20071114T000000Z
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20071114T000000Z
+ATTENDEE;CN=Foo;EMAIL=foo@example.com:urn:x-uid:foo
+ATTENDEE;CN=Fake 1;CUTYPE=ROOM:urn:x-uid:fake1
+ATTENDEE;CN=Fake 2;CUTYPE=ROOM:urn:x-uid:fake2
+LOCATION:Buzz
+DTSTAMP:20071114T000000Z
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;
+
+        component = Component.fromString(data)
+
+
+        def lookupFunction(cuaddr, ignored1, ignored2):
+            return succeed({
+                &quot;/principals/users/foo&quot; : (
+                    &quot;Foo&quot;,
+                    &quot;foo&quot;,
+                    &quot;INDIVIDUAL&quot;,
+                    (&quot;urn:x-uid:foo&quot;, &quot;mailto:foo@example.com&quot;)
+                ),
+                &quot;mailto:fake1@do_not_reply&quot; : (
+                    &quot;Fake 1&quot;,
+                    &quot;fake1&quot;,
+                    &quot;ROOM&quot;,
+                    (&quot;urn:x-uid:fake1&quot;, &quot;mailto:fake1@do_not_reply&quot;)
+                ),
+                &quot;mailto:fake2@do_not_reply&quot; : (
+                    &quot;Fake 2&quot;,
+                    &quot;fake2&quot;,
+                    &quot;ROOM&quot;,
+                    (&quot;urn:x-uid:fake2&quot;, &quot;mailto:fake2@do_not_reply&quot;)
+                ),
+            }[cuaddr])
+
+        component.normalizeCalendarUserAddresses(lookupFunction, None, toURN_UUID=True)
+
+        self.assertEqual(normalize_iCalStr(component), normalize_iCalStr(result))
+
+
</ins><span class="cx">     def test_serializationCaching(self):
</span><span class="cx"> 
</span><span class="cx">         data = &quot;&quot;&quot;BEGIN:VCALENDAR
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastoretestaccountsresourcesxml"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/test/accounts/resources.xml (15407 => 15408)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/test/accounts/resources.xml        2015-12-19 03:26:23 UTC (rev 15407)
+++ CalendarServer/trunk/txdav/common/datastore/test/accounts/resources.xml        2015-12-19 15:01:41 UTC (rev 15408)
</span><span class="lines">@@ -80,6 +80,11 @@
</span><span class="cx">     &lt;short-name&gt;sanchezoffice&lt;/short-name&gt;
</span><span class="cx">     &lt;full-name&gt;Sanchez Office&lt;/full-name&gt;
</span><span class="cx">   &lt;/record&gt;
</span><ins>+  &lt;record type=&quot;resource&quot;&gt;
+    &lt;short-name&gt;resource01&lt;/short-name&gt;
+    &lt;uid&gt;resource01&lt;/uid&gt;
+    &lt;full-name&gt;Resource 01&lt;/full-name&gt;
+  &lt;/record&gt;
</ins><span class="cx">   &lt;record type=&quot;location&quot;&gt;
</span><span class="cx">     &lt;uid&gt;75EA36BE-F71B-40F9-81F9-CF59BF40CA8F&lt;/uid&gt;
</span><span class="cx">     &lt;guid&gt;75EA36BE-F71B-40F9-81F9-CF59BF40CA8F&lt;/guid&gt;
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhoaugmentpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/augment.py (15407 => 15408)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/augment.py        2015-12-19 03:26:23 UTC (rev 15407)
+++ CalendarServer/trunk/txdav/who/augment.py        2015-12-19 15:01:41 UTC (rev 15408)
</span><span class="lines">@@ -476,6 +476,7 @@
</span><span class="cx"> 
</span><span class="cx">     def __init__(self, service, baseRecord, augmentedFields):
</span><span class="cx">         DirectoryRecord.__init__(self, service, augmentedFields)
</span><ins>+        CalendarDirectoryRecordMixin.__init__(self)
</ins><span class="cx">         self._baseRecord = baseRecord
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhodirectorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/directory.py (15407 => 15408)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/directory.py        2015-12-19 03:26:23 UTC (rev 15407)
+++ CalendarServer/trunk/txdav/who/directory.py        2015-12-19 15:01:41 UTC (rev 15408)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">     MatchType, Operand, MatchExpression, CompoundExpression, MatchFlags,
</span><span class="cx">     ExistsExpression, BooleanExpression
</span><span class="cx"> )
</span><del>-from twext.who.idirectory import RecordType as BaseRecordType
</del><ins>+from twext.who.idirectory import RecordType as BaseRecordType, FieldName as BaseFieldName
</ins><span class="cx"> from twisted.cred.credentials import UsernamePassword
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, returnValue
</span><span class="cx"> from twistedcaldav.config import config
</span><span class="lines">@@ -81,6 +81,10 @@
</span><span class="cx">         address = normalizeCUAddr(address)
</span><span class="cx">         record = None
</span><span class="cx"> 
</span><ins>+        if config.Scheduling.Options.FakeResourceLocationEmail:
+            if address.startswith(&quot;mailto:&quot;) and address.endswith(&quot;@do_not_reply&quot;):
+                address = &quot;urn:x-uid:{}&quot;.format(address[7:-13].decode(&quot;hex&quot;))
+
</ins><span class="cx">         if address.startswith(&quot;urn:x-uid:&quot;):
</span><span class="cx">             uid = address[10:]
</span><span class="cx">             record = yield self.recordWithUID(
</span><span class="lines">@@ -341,6 +345,12 @@
</span><span class="cx">     class
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx"> 
</span><ins>+    def __init__(self):
+        if config.Scheduling.Options.FakeResourceLocationEmail:
+            if self.recordType in (DAVRecordType.location, DAVRecordType.resource) and not getattr(self, &quot;emailAddresses&quot;, None):
+                self.fields[BaseFieldName.emailAddresses] = (&quot;{}@do_not_reply&quot;.format(self.uid.encode(&quot;hex&quot;),),)
+
+
</ins><span class="cx">     @inlineCallbacks
</span><span class="cx">     def verifyCredentials(self, credentials):
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhotesttest_directorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/test/test_directory.py (15407 => 15408)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/test/test_directory.py        2015-12-19 03:26:23 UTC (rev 15407)
+++ CalendarServer/trunk/txdav/who/test/test_directory.py        2015-12-19 15:01:41 UTC (rev 15408)
</span><span class="lines">@@ -19,15 +19,16 @@
</span><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> 
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks
</span><ins>+from twistedcaldav.config import config
</ins><span class="cx"> from twistedcaldav.test.util import StoreTestCase
</span><span class="cx"> from twext.who.directory import DirectoryRecord
</span><span class="cx"> from twext.who.idirectory import FieldName, RecordType
</span><span class="cx"> from txdav.who.directory import CalendarDirectoryRecordMixin, AutoScheduleMode
</span><del>-from txdav.who.util import startswithFilter
-from uuid import UUID
</del><span class="cx"> from twext.who.expression import (
</span><span class="cx">     MatchType, MatchFlags, MatchExpression
</span><span class="cx"> )
</span><ins>+from txdav.who.util import startswithFilter
+from uuid import UUID
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -206,6 +207,33 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><ins>+    def test_recordWithCalendarUserAddress_no_fake_email(self):
+        &quot;&quot;&quot;
+        Make sure that recordWithCalendarUserAddress handles fake emails for
+        resources and locations.
+        &quot;&quot;&quot;
+
+        record = yield self.directory.recordWithCalendarUserAddress(u&quot;mailto:{}@do_not_reply&quot;.format(&quot;resource01&quot;.encode(&quot;hex&quot;)))
+        self.assertTrue(record is None)
+        record = yield self.directory.recordWithCalendarUserAddress(u&quot;mailto:{}@do_not_reply&quot;.format(&quot;75EA36BE-F71B-40F9-81F9-CF59BF40CA8F&quot;.encode(&quot;hex&quot;)))
+        self.assertTrue(record is None)
+        record = yield self.directory.recordWithCalendarUserAddress(u&quot;mailto:{}@do_not_reply&quot;.format(&quot;resource02&quot;.encode(&quot;hex&quot;)))
+        self.assertTrue(record is None)
+
+
+    @inlineCallbacks
+    def test_calendarUserAddress_no_fake_email(self):
+        &quot;&quot;&quot;
+        Make sure that recordWs have fake email addresses.
+        &quot;&quot;&quot;
+
+        record = yield self.directory.recordWithUID(u&quot;resource01&quot;)
+        self.assertTrue(record is not None)
+        self.assertTrue(len(getattr(record, &quot;emailAddresses&quot;, ())) == 0)
+        self.assertTrue(len([cuaddr for cuaddr in record.calendarUserAddresses if cuaddr.startswith(&quot;mailto:&quot;)]) == 0)
+
+
+    @inlineCallbacks
</ins><span class="cx">     def test_recordsMatchingTokensNoFilter(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Records with names containing the token are returned
</span><span class="lines">@@ -328,3 +356,43 @@
</span><span class="cx">                 ),
</span><span class="cx">                 notInGroupMode
</span><span class="cx">             )
</span><ins>+
+
+
+class DirectoryTestCaseFakeEmail(StoreTestCase):
+
+
+    def configure(self):
+        &quot;&quot;&quot;
+        Adjust the global configuration for this test.
+        &quot;&quot;&quot;
+        super(StoreTestCase, self).configure()
+
+        config.Scheduling.Options.FakeResourceLocationEmail = True
+
+
+    @inlineCallbacks
+    def test_recordWithCalendarUserAddress_fake_email(self):
+        &quot;&quot;&quot;
+        Make sure that recordWithCalendarUserAddress handles fake emails for
+        resources and locations.
+        &quot;&quot;&quot;
+
+        record = yield self.directory.recordWithCalendarUserAddress(u&quot;mailto:{}@do_not_reply&quot;.format(&quot;resource01&quot;.encode(&quot;hex&quot;)))
+        self.assertTrue(record is not None)
+        record = yield self.directory.recordWithCalendarUserAddress(u&quot;mailto:{}@do_not_reply&quot;.format(&quot;75EA36BE-F71B-40F9-81F9-CF59BF40CA8F&quot;.encode(&quot;hex&quot;)))
+        self.assertTrue(record is not None)
+        record = yield self.directory.recordWithCalendarUserAddress(u&quot;mailto:{}@do_not_reply&quot;.format(&quot;resource02&quot;.encode(&quot;hex&quot;)))
+        self.assertTrue(record is None)
+
+
+    @inlineCallbacks
+    def test_calendarUserAddress_fake_email(self):
+        &quot;&quot;&quot;
+        Make sure that recordWs have fake email addresses.
+        &quot;&quot;&quot;
+
+        record = yield self.directory.recordWithUID(u&quot;resource01&quot;)
+        self.assertTrue(record is not None)
+        self.assertIn(u&quot;{}@do_not_reply&quot;.format(&quot;resource01&quot;.encode(&quot;hex&quot;)), record.emailAddresses)
+        self.assertIn(u&quot;mailto:{}@do_not_reply&quot;.format(&quot;resource01&quot;.encode(&quot;hex&quot;)), record.calendarUserAddresses)
</ins></span></pre></div>
<a id="CalendarServertrunktxdavwhowikipy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/wiki.py (15407 => 15408)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/wiki.py        2015-12-19 03:26:23 UTC (rev 15407)
+++ CalendarServer/trunk/txdav/who/wiki.py        2015-12-19 15:01:41 UTC (rev 15408)
</span><span class="lines">@@ -148,6 +148,11 @@
</span><span class="cx">     log = Logger()
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    def __init__(self, service, fields):
+        BaseDirectoryRecord.__init__(self, service, fields)
+        CalendarDirectoryRecordMixin.__init__(self)
+
+
</ins><span class="cx">     @property
</span><span class="cx">     def name(self):
</span><span class="cx">         return self.shortNames[0]
</span></span></pre>
</div>
</div>

</body>
</html>