summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniko <niko>2012-10-10 23:36:25 (GMT)
committerniko <niko>2012-10-10 23:36:25 (GMT)
commitc31bac757b955020c70c0e479da97f47d0f743fe (patch)
treea0324e3be871698c69ccc6517621c5921841f63a
parent6daf5080a22fcebe965f23930cfa7de6c56af900 (diff)
downloadsynckolab-c31bac757b955020c70c0e479da97f47d0f743fe.tar.gz
update tests
-rw-r--r--test/synckolab/parser/kolab3/calendarTest.js1
-rw-r--r--test/synckolab/parser/kolab3/contactTest.js17
-rw-r--r--test/synckolab/parser/kolab3/json/contact.complex.mime.json1
-rw-r--r--test/synckolab/parser/kolab3/json/contact.test.mime.json1
-rw-r--r--test/synckolab/parser/kolab3/json/list.test1.eml.json33
-rw-r--r--test/synckolab/parser/kolab3/raw/list.test.eml44
-rw-r--r--test/synckolab/parser/kolab3/raw/list.test1.eml52
-rw-r--r--test/synckolab/parser/kolab3/raw/list.test2.mime (renamed from test/synckolab/parser/kolab3/raw/distlist.test1.mime)0
-rw-r--r--test/synckolab/parser/kolab3/xml/list.test1.eml.xml22
9 files changed, 164 insertions, 7 deletions
diff --git a/test/synckolab/parser/kolab3/calendarTest.js b/test/synckolab/parser/kolab3/calendarTest.js
index 8566bd5..c2133aa 100644
--- a/test/synckolab/parser/kolab3/calendarTest.js
+++ b/test/synckolab/parser/kolab3/calendarTest.js
@@ -31,6 +31,7 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
}
});
*/
+
var testFiles = ["event.complex.mime"];
diff --git a/test/synckolab/parser/kolab3/contactTest.js b/test/synckolab/parser/kolab3/contactTest.js
index 7f8e6ae..51f0044 100644
--- a/test/synckolab/parser/kolab3/contactTest.js
+++ b/test/synckolab/parser/kolab3/contactTest.js
@@ -12,7 +12,7 @@ load("test/lib/testOverride.js");
test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
equal(null, synckolab.addressbookTools.parseMessageContent(null), "parsing a null message");
- var testFiles = ["contact.simple.mime","contact.complex.mime","contact.test.mime","contact.test2.mime"];
+ var testFiles = ["contact.simple.mime","contact.complex.mime","contact.test.mime","contact.test2.mime", "list.test1.eml"];
var content, entry, jsonEntry;
@@ -27,7 +27,11 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
equal(synckolab.tools.equalsObject(entry, jsonEntry), true, src);
// json -> kolab 3 xml
- content = synckolab.addressbookTools.card2Kolab3(entry);
+ if(entry.type === "maillist") {
+ content = synckolab.addressbookTools.list2Kolab3(entry);
+ } else {
+ content = synckolab.addressbookTools.card2Kolab3(entry);
+ }
xmlcontent = readFile("test/synckolab/parser/kolab3/xml/"+src + ".xml");
if (xmlcontent.replace(/[\n\r\t ]/g, "").length != content.replace(/[\n\r\t ]/g, "").length) {
var diff = diffString(xmlcontent, content)
@@ -36,7 +40,7 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
}
});
/*
- var testFiles = ["contact.test.mime"];
+ var testFiles = ["list.test1.eml"];
var content, entry, jsonEntry;
@@ -51,7 +55,11 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
entry = synckolab.addressbookTools.parseMessageContent(content);
print(JSON.stringify(entry, null, ' '))
// json -> kolab 3 xml
- content = synckolab.addressbookTools.card2Kolab3(entry);
+ if(entry.type === "maillist") {
+ content = synckolab.addressbookTools.list2Kolab3(entry);
+ } else {
+ content = synckolab.addressbookTools.card2Kolab3(entry);
+ }
print("=== parsed XML");
print(content);
xmlcontent = readFile("test/synckolab/parser/kolab3/xml/"+src + ".xml");
@@ -62,5 +70,4 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
}
-
*/ \ No newline at end of file
diff --git a/test/synckolab/parser/kolab3/json/contact.complex.mime.json b/test/synckolab/parser/kolab3/json/contact.complex.mime.json
index aa09bfb..503f28f 100644
--- a/test/synckolab/parser/kolab3/json/contact.complex.mime.json
+++ b/test/synckolab/parser/kolab3/json/contact.complex.mime.json
@@ -24,7 +24,6 @@
"WorkZipCode": "Work Postal Code",
"WorkCountry": "Azerbaijan",
"NickName": "Nickname",
- "related": "Partner",
"BirthYear": 2009,
"BirthMonth": 7,
"BirthDay": 27,
diff --git a/test/synckolab/parser/kolab3/json/contact.test.mime.json b/test/synckolab/parser/kolab3/json/contact.test.mime.json
index 95a23e0..bff573d 100644
--- a/test/synckolab/parser/kolab3/json/contact.test.mime.json
+++ b/test/synckolab/parser/kolab3/json/contact.test.mime.json
@@ -17,7 +17,6 @@
"BirthYear": 2012,
"BirthMonth": 10,
"BirthDay": 20,
- "gender": "\n ",
"HomePhone": "+43 homephone",
"PrimaryEmail": "email1@test.com",
"sha1": "f3940b0058e3b564ed2dc0c9f667b54725d2ffde"
diff --git a/test/synckolab/parser/kolab3/json/list.test1.eml.json b/test/synckolab/parser/kolab3/json/list.test1.eml.json
new file mode 100644
index 0000000..4b3e657
--- /dev/null
+++ b/test/synckolab/parser/kolab3/json/list.test1.eml.json
@@ -0,0 +1,33 @@
+{
+ "synckolab": "3.0.0",
+ "type": "maillist",
+ "isMailList": true,
+ "ts": 1349908157804,
+ "UUID": "list_name",
+ "DisplayName": "list-name",
+ "Notes": "list-description",
+ "NickName": "list-nickname",
+ "contacts": [
+ {
+ "synckolab": "3.0.0",
+ "listMember": true,
+ "type": "contact",
+ "isMailList": false,
+ "ts": 1349908157831,
+ "DisplayName": "testöä lastname",
+ "PrimaryEmail": "email@mail.com",
+ "UUID": "urn:uuid:pas-id-1D84CEA337CD1878"
+ },
+ {
+ "synckolab": "3.0.0",
+ "listMember": true,
+ "type": "contact",
+ "isMailList": false,
+ "ts": 1349908157832,
+ "DisplayName": "cont2#öüä&$",
+ "PrimaryEmail": "weird@email.com",
+ "UUID": "urn:uuid:pas-id-A4E937D838A897AD"
+ }
+ ],
+ "sha1": "8d2e5e0088530d5fbe9f6acc40a5e3eb2c094ec7"
+} \ No newline at end of file
diff --git a/test/synckolab/parser/kolab3/raw/list.test.eml b/test/synckolab/parser/kolab3/raw/list.test.eml
new file mode 100644
index 0000000..018578e
--- /dev/null
+++ b/test/synckolab/parser/kolab3/raw/list.test.eml
@@ -0,0 +1,44 @@
+From: test@test.com
+Reply-To:
+Bcc:
+To: synckolab@no.tld
+Subject: list_name
+Date: Thu, 11 Oct 2012 00:18:01 +0200
+Content-Type: Multipart/Mixed;boundary="Boundary-00=88BC9C1E6E40C1D6"
+User-Agent: SyncKolab 2.9.0
+X-Kolab-Type: application/x-vcard.list+xml
+
+--Boundary-00=88BC9C1E6E40C1D6
+Content-Type: Text/Plain;
+ charset="us-ascii"
+Content-Transfer-Encoding: 7bit
+
+This is a Kolab Groupware object.
+To view this object you will need an email client that can understand the Kolab Groupware format.
+For a list of such email clients please visit
+http://www.kolab.org/kolab2-clients.html
+---
+Name: list-name
+Notes: list-description
+Members:
+
+---
+
+Notice:
+The information above is only valid, if no other client than synckolab updated this message. (ie. a client that updates the attachment but not the message)
+
+--Boundary-00=88BC9C1E6E40C1D6
+Content-Type: application/x-vcard.list+xml;
+ name="kolab.xml"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+ filename="kolab.xml"
+
+PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHZsaXN0IHZlcnNpb249IjEuMCIg
+PgogPHByb2R1Y3QtaWQ+U3luY0tvbGFiIDIuOS4wLCBLb2xhYiByZXNvdXJjZTwvcHJvZHVjdC1pZD4K
+IDx1aWQ+bGlzdF9uYW1lPC91aWQ+CiA8Y3JlYXRpb24tZGF0ZT4yMDEyMTAxMFQyMjE4MDFaPC9jcmVh
+dGlvbi1kYXRlPgogPGxhc3QtbW9kaWZpY2F0aW9uLWRhdGU+MjAxMjEwMTBUMjIxODAxWjwvbGFzdC1t
+b2RpZmljYXRpb24tZGF0ZT4KIDxzZW5zaXRpdml0eT5wdWJsaWM8L3NlbnNpdGl2aXR5PgogPG5hbWU+
+bGlzdC1uYW1lPC9uYW1lPgogPG5vdGVzPjx0ZXh0Pmxpc3QtZGVzY3JpcHRpb248L3RleHQ+PC9ub3Rl
+cz4KIDxuaWNrbmFtZT5saXN0LW5pY2tuYW1lPC9uaWNrbmFtZT4KPC92bGlzdD4K
+--Boundary-00=88BC9C1E6E40C1D6--
diff --git a/test/synckolab/parser/kolab3/raw/list.test1.eml b/test/synckolab/parser/kolab3/raw/list.test1.eml
new file mode 100644
index 0000000..f2171cb
--- /dev/null
+++ b/test/synckolab/parser/kolab3/raw/list.test1.eml
@@ -0,0 +1,52 @@
+MIME-Version: 1.0
+Content-Type: text/plain; charset="US-ASCII"
+From: grote2@demo.kolab.org
+To: grote2@demo.kolab.org
+Date: Mon, 08 Oct 2012 15:13:16 +0200
+X-Kolab-Type: application/x-vnd.kolab.contact
+X-Kolab-Mime-Version: 3.0
+Subject: ebf6fdc2-1149-11e2-841b-000476ed9009
+User-Agent: Roundcube Webmail/0.9-0.10.git954540a3.el6.kolab_3.0
+
+--=_fa2884819e665b9976ebbf6fea3ebc10
+Content-Transfer-Encoding: quoted-printable
+Content-Type: text/plain; charset="ISO-8859-1"
+
+This is a Kolab Groupware object. To view this object you will need an emai=
+l client that understands the Kolab Groupware format. For a list of such em=
+ail clients please visit http: //www.kolab.org/
+
+
+--=_fa2884819e665b9976ebbf6fea3ebc10
+Content-Transfer-Encoding: 8bit
+Content-Type: application/vcard+xml; charset="UTF-8"; name="kolab.xml"
+Content-Disposition: attachment; filename="kolab.xml"
+
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<vcards xmlns="urn:ietf:params:xml:ns:vcard-4.0">
+
+<vcard>
+ <uid><uri>list_name</uri></uid>
+ <prodid><text>SyncKolab 3.0.0, Kolab resource</text></prodid>
+ <rev><timestamp>19700101T000000ZZ</timestamp></rev>
+ <fn><text>list-name</text></fn>
+ <nickname>
+ <text>list-nickname</text>
+ </nickname>
+ <note>
+ <text>list-description</text>
+ </note>
+ <member>
+ <dn><text>testöä lastname</text></dn>
+ <email><text>email@mail.com</text></email>
+ <uid><uri>urn:uuid:pas-id-1D84CEA337CD1878</uri></uid>
+ </member>
+ <member>
+ <dn><text>cont2#öüä&amp;$</text></dn>
+ <email><text>weird@email.com</text></email>
+ <uid><uri>urn:uuid:pas-id-A4E937D838A897AD</uri></uid>
+ </member>
+</vcard>
+
+</vcards>
+--=_fa2884819e665b9976ebbf6fea3ebc10--
diff --git a/test/synckolab/parser/kolab3/raw/distlist.test1.mime b/test/synckolab/parser/kolab3/raw/list.test2.mime
index d54c26c..d54c26c 100644
--- a/test/synckolab/parser/kolab3/raw/distlist.test1.mime
+++ b/test/synckolab/parser/kolab3/raw/list.test2.mime
diff --git a/test/synckolab/parser/kolab3/xml/list.test1.eml.xml b/test/synckolab/parser/kolab3/xml/list.test1.eml.xml
new file mode 100644
index 0000000..ce8c6e3
--- /dev/null
+++ b/test/synckolab/parser/kolab3/xml/list.test1.eml.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vcard>
+ <product-id>SyncKolab 3.0.0, Kolab resource</product-id>
+ <uid>list_name</uid>
+ <creation-date>20121010T233013Z</creation-date>
+ <last-modification-date>20121010T233013Z</last-modification-date>
+ <sensitivity>public</sensitivity>
+ <name>list-name</name>
+ <notes><text>list-description</text></notes>
+ <nickname>list-nickname</nickname>
+ <member>
+ <dn><text>testöä lastname</text></dn>
+ <email><text>email@mail.com</text></email>
+ <uid><urn>urn:uuid:pas-id-1D84CEA337CD1878</urn></uid>
+ </member>
+ <member>
+ <dn><text>cont2#öüä&amp;$</text></dn>
+ <email><text>weird@email.com</text></email>
+ <uid><urn>urn:uuid:pas-id-A4E937D838A897AD</urn></uid>
+ </member>
+</vcard>
+</vcards> \ No newline at end of file