summaryrefslogtreecommitdiffstats
path: root/comm/calendar/test/browser/data
diff options
context:
space:
mode:
Diffstat (limited to 'comm/calendar/test/browser/data')
-rw-r--r--comm/calendar/test/browser/data/attachment.pngbin0 -> 82 bytes
-rw-r--r--comm/calendar/test/browser/data/calendars.sjs126
-rw-r--r--comm/calendar/test/browser/data/dns.sjs56
-rw-r--r--comm/calendar/test/browser/data/event.ics10
-rw-r--r--comm/calendar/test/browser/data/import.ics24
-rw-r--r--comm/calendar/test/browser/data/principal.sjs39
6 files changed, 255 insertions, 0 deletions
diff --git a/comm/calendar/test/browser/data/attachment.png b/comm/calendar/test/browser/data/attachment.png
new file mode 100644
index 0000000000..30caecab7b
--- /dev/null
+++ b/comm/calendar/test/browser/data/attachment.png
Binary files differ
diff --git a/comm/calendar/test/browser/data/calendars.sjs b/comm/calendar/test/browser/data/calendars.sjs
new file mode 100644
index 0000000000..f1175f1903
--- /dev/null
+++ b/comm/calendar/test/browser/data/calendars.sjs
@@ -0,0 +1,126 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
+
+Cu.importGlobalProperties(["TextEncoder"]);
+
+function handleRequest(request, response) {
+ if (!request.hasHeader("Authorization")) {
+ response.setStatusLine("1.1", 401, "Unauthorized");
+ response.setHeader("WWW-Authenticate", `Basic realm="test"`);
+ return;
+ }
+
+ response.setStatusLine("1.1", 207, "Multi-Status");
+ response.setHeader("Content-Type", "text/xml; charset=utf-8", false);
+
+ // Request:
+ // <propfind>
+ // <prop>
+ // <resourcetype/>
+ // <displayname/>
+ // <current-user-privilege-set/>
+ // <calendar-color/>
+ // </prop>
+ // </propfind>
+
+ let res = `<multistatus xmlns="DAV:"
+ xmlns:A="http://apple.com/ns/ical/"
+ xmlns:C="urn:ietf:params:xml:ns:caldav"
+ xmlns:CS="http://calendarserver.org/ns/">
+ <response>
+ <href>/browser/comm/calendar/test/browser/data/calendars.sjs</href>
+ <propstat>
+ <prop>
+ <resourcetype>
+ <collection/>
+ </resourcetype>
+ <displayname>Things found by DNS</displayname>
+ </prop>
+ <status>HTTP/1.1 200 OK</status>
+ </propstat>
+ <propstat>
+ <prop>
+ <current-user-privilege-set/>
+ <A:calendar-color/>
+ </prop>
+ <status>HTTP/1.1 404 Not Found</status>
+ </propstat>
+ </response>
+ <response>
+ <href>/browser/comm/calendar/test/browser/data/calendar.sjs</href>
+ <propstat>
+ <prop>
+ <resourcetype>
+ <collection/>
+ <C:calendar/>
+ <CS:shared/>
+ </resourcetype>
+ <displayname>You found me!</displayname>
+ <A:calendar-color>#008000</A:calendar-color>
+ </prop>
+ <status>HTTP/1.1 200 OK</status>
+ </propstat>
+ <propstat>
+ <prop>
+ <current-user-privilege-set/>
+ </prop>
+ <status>HTTP/1.1 404 Not Found</status>
+ </propstat>
+ </response>
+ <response>
+ <href>/browser/comm/calendar/test/browser/data/calendar2.sjs</href>
+ <propstat>
+ <prop>
+ <resourcetype>
+ <collection/>
+ <C:calendar/>
+ <CS:shared/>
+ </resourcetype>
+ <displayname>Röda dagar</displayname>
+ <A:calendar-color>#ff0000</A:calendar-color>
+ <current-user-privilege-set>
+ <privilege>
+ <read/>
+ </privilege>
+ <privilege>
+ <C:read-free-busy/>
+ </privilege>
+ <privilege>
+ <read-current-user-privilege-set/>
+ </privilege>
+ <privilege>
+ <write/>
+ </privilege>
+ <privilege>
+ <write-content/>
+ </privilege>
+ <privilege>
+ <write-properties/>
+ </privilege>
+ <privilege>
+ <bind/>
+ </privilege>
+ <privilege>
+ <unbind/>
+ </privilege>
+ </current-user-privilege-set>
+ </prop>
+ <status>HTTP/1.1 200 OK</status>
+ </propstat>
+ <propstat>
+ <prop>
+ <current-user-privilege-set/>
+ </prop>
+ <status>HTTP/1.1 404 Not Found</status>
+ </propstat>
+ </response>
+ </multistatus>`;
+
+ let bytes = new TextEncoder().encode(res);
+ let str = "";
+ for (let i = 0; i < bytes.length; i += 65536) {
+ str += String.fromCharCode.apply(null, bytes.subarray(i, i + 65536));
+ }
+ response.write(str);
+}
diff --git a/comm/calendar/test/browser/data/dns.sjs b/comm/calendar/test/browser/data/dns.sjs
new file mode 100644
index 0000000000..85b8777233
--- /dev/null
+++ b/comm/calendar/test/browser/data/dns.sjs
@@ -0,0 +1,56 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
+
+function handleRequest(request, response) {
+ if (!request.hasHeader("Authorization")) {
+ response.setStatusLine("1.1", 401, "Unauthorized");
+ response.setHeader("WWW-Authenticate", `Basic realm="test"`);
+ return;
+ }
+
+ response.setStatusLine("1.1", 207, "Multi-Status");
+ response.setHeader("Content-Type", "text/xml", false);
+
+ // Request:
+ // <propfind>
+ // <prop>
+ // <resourcetype/>
+ // <owner/>
+ // <displayname/>
+ // <current-user-principal/>
+ // <current-user-privilege-set/>
+ // <calendar-color/>
+ // <calendar-home-set/>
+ // </prop>
+ // </propfind>
+
+ response.write(`<multistatus xmlns="DAV:"
+ xmlns:A="http://apple.com/ns/ical/"
+ xmlns:C="urn:ietf:params:xml:ns:caldav">
+ <response>
+ <href>/browser/comm/calendar/test/browser/data/dns.sjs</href>
+ <propstat>
+ <prop>
+ <resourcetype>
+ <collection/>
+ </resourcetype>
+ <current-user-principal>
+ <href>/browser/comm/calendar/test/browser/data/principal.sjs</href>
+ </current-user-principal>
+ </prop>
+ <status>HTTP/1.1 200 OK</status>
+ </propstat>
+ <propstat>
+ <prop>
+ <owner/>
+ <displayname/>
+ <current-user-privilege-set/>
+ <A:calendar-color/>
+ <C:calendar-home-set/>
+ </prop>
+ <status>HTTP/1.1 404 Not Found</status>
+ </propstat>
+ </response>
+ </multistatus>`);
+}
diff --git a/comm/calendar/test/browser/data/event.ics b/comm/calendar/test/browser/data/event.ics
new file mode 100644
index 0000000000..3ee7fd4495
--- /dev/null
+++ b/comm/calendar/test/browser/data/event.ics
@@ -0,0 +1,10 @@
+BEGIN:VCALENDAR
+PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
+VERSION:2.0
+BEGIN:VEVENT
+SUMMARY:An Event
+DESCRIPTION:Parking is not available.
+DTSTART:20210325T110000Z
+DTEND:20210325T120000Z
+END:VEVENT
+END:VCALENDAR
diff --git a/comm/calendar/test/browser/data/import.ics b/comm/calendar/test/browser/data/import.ics
new file mode 100644
index 0000000000..b6e7a965d7
--- /dev/null
+++ b/comm/calendar/test/browser/data/import.ics
@@ -0,0 +1,24 @@
+BEGIN:VCALENDAR
+PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
+VERSION:2.0
+BEGIN:VEVENT
+SUMMARY:Event One
+DTSTART:20190101T150000
+DTEND:20190101T160000
+END:VEVENT
+BEGIN:VEVENT
+SUMMARY:Event Four
+DTSTART:20190101T180000
+DTEND:20190101T190000
+END:VEVENT
+BEGIN:VEVENT
+SUMMARY:Event Three
+DTSTART:20190101T170000
+DTEND:20190101T180000
+END:VEVENT
+BEGIN:VEVENT
+SUMMARY:Event Two
+DTSTART:20190101T160000
+DTEND:20190101T170000
+END:VEVENT
+END:VCALENDAR
diff --git a/comm/calendar/test/browser/data/principal.sjs b/comm/calendar/test/browser/data/principal.sjs
new file mode 100644
index 0000000000..4cebd9660e
--- /dev/null
+++ b/comm/calendar/test/browser/data/principal.sjs
@@ -0,0 +1,39 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
+
+function handleRequest(request, response) {
+ if (!request.hasHeader("Authorization")) {
+ response.setStatusLine("1.1", 401, "Unauthorized");
+ response.setHeader("WWW-Authenticate", `Basic realm="test"`);
+ return;
+ }
+
+ response.setStatusLine("1.1", 207, "Multi-Status");
+ response.setHeader("Content-Type", "text/xml", false);
+
+ // Request:
+ // <propfind>
+ // <prop>
+ // <resourcetype/>
+ // <calendar-home-set/>
+ // </prop>
+ // </propfind>
+
+ response.write(`<multistatus xmlns="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
+ <response>
+ <href>/browser/comm/calendar/test/browser/data/principal.sjs</href>
+ <propstat>
+ <prop>
+ <resourcetype>
+ <principal/>
+ </resourcetype>
+ <C:calendar-home-set>
+ <href>/browser/comm/calendar/test/browser/data/calendars.sjs</href>
+ </C:calendar-home-set>
+ </prop>
+ <status>HTTP/1.1 200 OK</status>
+ </propstat>
+ </response>
+ </multistatus>`);
+}