summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorniko <niko>2012-10-27 00:43:25 (GMT)
committerniko <niko>2012-10-27 00:43:25 (GMT)
commit23f86ba282449381f8ed5dc82b50673a02c6b93f (patch)
treeb6ebeb34684c53bc09620727f0443c18be6be0f4 /test
parent3ce6a3cf783d624c84e0a05a6a03310ad43c6e9a (diff)
downloadsynckolab-23f86ba282449381f8ed5dc82b50673a02c6b93f.tar.gz
rewrite parsing
Diffstat (limited to 'test')
-rw-r--r--test/lib/testOverride.js2
-rw-r--r--test/suite.js2
-rw-r--r--test/synckolab/parser/kolab2/contactTest.js19
-rw-r--r--test/synckolab/parser/kolab2/json/contactFullTest.json2
-rw-r--r--test/synckolab/parser/kolab2/json/test-image.json8
-rw-r--r--test/synckolab/parser/kolab2/raw/contactFullTest.eml5
-rw-r--r--test/synckolab/parser/kolab2/raw/contactMinimalTest.eml5
-rw-r--r--test/synckolab/parser/kolab2/raw/testcontact.eml2
-rw-r--r--test/synckolab/parser/kolab3/calendarTest.js4
-rw-r--r--test/synckolab/parser/kolab3/contactTest.js13
-rw-r--r--test/synckolab/parser/kolab3/json/contact.complex.mime.json6
-rw-r--r--test/synckolab/parser/kolab3/json/contact.simple.mime.json4
-rw-r--r--test/synckolab/parser/kolab3/json/contact.test.mime.json4
-rw-r--r--test/synckolab/parser/kolab3/json/contact.test2.mime.json4
-rw-r--r--test/synckolab/parser/kolab3/json/contact.test3.mime.json1
-rw-r--r--test/synckolab/parser/kolab3/raw/contact.complex.mime2
-rw-r--r--test/synckolab/parser/kolab3/raw/contact.test3.mime50
-rw-r--r--test/synckolab/parser/kolab3/xml/contact.complex.mime.xml7
-rw-r--r--test/synckolab/parser/kolab3/xml/contact.simple.mime.xml1
-rw-r--r--test/synckolab/parser/kolab3/xml/contact.test.mime.xml1
-rw-r--r--test/synckolab/parser/kolab3/xml/contact.test2.mime.xml1
-rw-r--r--test/synckolab/parser/kolab3/xml/contact.test3.mime.xml17
-rw-r--r--test/synckolab/tools/data/multipart.eml74
-rw-r--r--test/synckolab/tools/toolsTest.js19
24 files changed, 211 insertions, 42 deletions
diff --git a/test/lib/testOverride.js b/test/lib/testOverride.js
index dbf7366..0538f5f 100644
--- a/test/lib/testOverride.js
+++ b/test/lib/testOverride.js
@@ -36,7 +36,7 @@ synckolab.tools.parseXml = function(content) {
}
synckolab.tools.logMessage = function(msg, level) {
- if (!level) {
+ if (typeof (level) === "undefined") {
print("NO LEVEL GIVEN: " + synckolab.tools.trace());
}
var infolvl = synckolab.config.DEBUG_SYNCKOLAB_LEVEL%4;
diff --git a/test/suite.js b/test/suite.js
index 0e13548..322460b 100644
--- a/test/suite.js
+++ b/test/suite.js
@@ -44,7 +44,7 @@ load("test/synckolab/parser/kolab2/calendarTest.js");
load("test/synckolab/parser/kolab2/contactTest.js");
load("test/synckolab/parser/kolab3/contactTest.js");
//load("test/synckolab/parser/kolab3/calendarTest.js");
-
+//*/
print("========================")
print("Tests Run: " + (testRuns.fail+testRuns.pass));
print(" Passed Tests: " + testRuns.pass);
diff --git a/test/synckolab/parser/kolab2/contactTest.js b/test/synckolab/parser/kolab2/contactTest.js
index c81ca20..1a197ed 100644
--- a/test/synckolab/parser/kolab2/contactTest.js
+++ b/test/synckolab/parser/kolab2/contactTest.js
@@ -21,12 +21,13 @@ test("skolab2 ynckolab.addressbookTools.parseMessageContent", function(){
print("INFO: KOLAB 2 TESTING CONTACT: " + src +"\n");
content = readFile("test/synckolab/parser/kolab2/raw/"+src+".eml");
- content = synckolab.tools.stripMailHeader(content);
+ content = synckolab.tools.parseMail(content);
+
entry = synckolab.addressbookTools.parseMessageContent(content);
+
content = readFile("test/synckolab/parser/kolab2/json/"+src+".json");
jsonEntry = JSON.parse(content);
equal(synckolab.tools.equalsObject(entry, jsonEntry, {UUID:true}), true, src + "\n" + JSON.stringify(entry, null, " "));
-
// json -> kolab 2 xml
/*
if(entry.type === "maillist") {
@@ -47,18 +48,22 @@ test("skolab2 ynckolab.addressbookTools.parseMessageContent", function(){
});
-
/*
-var testFiles = ["contactMinimalTest", "contactFullTest", "list.test", "list.test2"];
+
+var testFiles = ["contactMinimalTest"]; //, "contactMinimalTest", "contactFullTest", "list.test", "list.test2"];
var content, entry, jsonEntry;
for(var i = 0; i < testFiles.length; i++) {
var src = testFiles[i];
- content = readFile("test/synckolab/parser/kolab2/raw/"+src+".xml");
+ content = readFile("test/synckolab/parser/kolab2/raw/"+src+".eml");
+ content = content.replace (/\#\$\#/g, "");
+ print("CONTENT: " + content + "\n\n");
+ content = synckolab.tools.parseMail(content);
+ print(" PRSED CONTENT: " + content)
entry = synckolab.addressbookTools.parseMessageContent(content);
+ print(JSON.stringify(entry, null, " "));
content = readFile("test/synckolab/parser/kolab2/json/"+src+".json");
jsonEntry = JSON.parse(content);
}
-
-*/ \ No newline at end of file
+//*/
diff --git a/test/synckolab/parser/kolab2/json/contactFullTest.json b/test/synckolab/parser/kolab2/json/contactFullTest.json
index f900772..f71c692 100644
--- a/test/synckolab/parser/kolab2/json/contactFullTest.json
+++ b/test/synckolab/parser/kolab2/json/contactFullTest.json
@@ -1 +1 @@
-{"synckolab":"2.0.2","type":"contact","isMailList":false,"ts":1341399615448,"UUID":"pas-id-1D84CEA337CD1878","Notes":"multiline\nnote with öäü!","FirstName":"testöä","LastName":"lastnameöäü","DisplayName":"testöä lastname","Company":"w-org","WebPage1":"w-web","WebPage2":"p-web","Department":"w-department","JobTitle":"w-title","NickName":"nick","BirthYear":"1980","BirthMonth":"01","BirthDay":"22","HomePhone":"01-home","WorkPhone":"01-work","FaxNumber":"01-fax","CellularNumber":"01-mobile","PagerNumber":"01-page","PrimaryEmail":"email@mail.com","SecondEmail":"additional@mail.com","HomeAddress":"priv-addr1","HomeAddress2":"priv-addr2","HomeCity":"priv-city","HomeState":"priv-state","HomeZipCode":"p123","HomeCountry":"p-country","WorkAddress":"w-addr1","WorkAddress2":"w-addr2","WorkCity":"w-city","WorkState":"w-state","WorkZipCode":"w123","WorkCountry":"w-country","Custom1":"cust1","Custom2":"cust2","Custom3":"cust3","AllowRemoteContent":true,"sha1":"6045abc16ac427b939636fd110fe44d5f55b9d0f"} \ No newline at end of file
+{"synckolab":"2.0.2","type":"contact","isMailList":false,"ts":1341399615448,"UUID":"pas-id-1D84CEA337CD1878","Notes":"multiline\nnote with öäü!","FirstName":"testöä","LastName":"lastnameöäü","DisplayName":"testöä lastname","Company":"w-org","WebPage1":"w-web","WebPage2":"p-web","Department":"w-department","JobTitle":"w-title","NickName":"nick","BirthYear":1980,"BirthMonth":1,"BirthDay":22,"HomePhone":"01-home","WorkPhone":"01-work","FaxNumber":"01-fax","CellularNumber":"01-mobile","PagerNumber":"01-page","PrimaryEmail":"email@mail.com","SecondEmail":"additional@mail.com","HomeAddress":"priv-addr1","HomeAddress2":"priv-addr2","HomeCity":"priv-city","HomeState":"priv-state","HomeZipCode":"p123","HomeCountry":"p-country","WorkAddress":"w-addr1","WorkAddress2":"w-addr2","WorkCity":"w-city","WorkState":"w-state","WorkZipCode":"w123","WorkCountry":"w-country","Custom1":"cust1","Custom2":"cust2","Custom3":"cust3","AllowRemoteContent":true,"sha1":"6045abc16ac427b939636fd110fe44d5f55b9d0f"} \ No newline at end of file
diff --git a/test/synckolab/parser/kolab2/json/test-image.json b/test/synckolab/parser/kolab2/json/test-image.json
index 3ce35ea..3758b7a 100644
--- a/test/synckolab/parser/kolab2/json/test-image.json
+++ b/test/synckolab/parser/kolab2/json/test-image.json
@@ -2,10 +2,7 @@
"synckolab": "3.0.0",
"type": "contact",
"isMailList": false,
- "ts": 1351254809554,
- "PhotoName": "8028141781098217.jpg",
- "PhotoType": "inline",
- "PhotoData": "/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQU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lpxTbWjt33KiStBXe/XEs1qZ8Mclk+JUmCJrauf//EAB4RAAICAQUBAAAAAAAAAAAAAAERACFhEEFRcfGx/9oACAECAQE/EDN98N3DCvsGBZnzQ2OwKBz5LYoLKpDO/MegwVC73gwjvKuCpwcw4IyGhP/EAB4QAQADAAIDAQEAAAAAAAAAAAEAESExQWFxgVGR/9oACAEBAAE/EGNXHVBgVuu/c7gmGU0LTUALCC8n4N0psqWVx0iTwqSkxrxkU3AqhEQoAtKxfkE8jVUUrStOE9QO/bFYKKcaSu13AJrADgOKyV1Uov20MRwXp65qXb4Jgii6vhT7L6zgMP4RVbGaEqsTHyf/2Q",
+ "ts": 1351292484677,
"UUID": "sk-vc-231B43ABE83388D3",
"Notes": "Introduced by a software engineer.",
"FirstName": "First",
@@ -16,6 +13,9 @@
"NickName": "Name, First",
"PrimaryEmail": "name@yahoo.com",
"PreferMailFormat": 2,
+ "PhotoName": "8028140781098217.jpg",
+ "PhotoType": "inline",
+ "PhotoData": "/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAMCAgMCAgMDAwME\r\nAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBD\r\nAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU\r\nFBQUFBQUFBT/wgARCAAYABwDAREAAhEBAxEB/8QAGAABAAMBAAAAAAAAAAAAAAAABwQFBgj/xAAZ\r\nAQEAAwEBAAAAAAAAAAAAAAAEAgMFAAH/2gAMAwEAAhADEAAAAegj2mZD2N61phzUd1WPFn26iLoy\r\nIwsycPJ3SUWl/8QAHBAAAwEAAgMAAAAAAAAAAAAAAwQFAgABBhIT/9oACAEBAAEFArVcM0LNvDu5\r\nOCtZX32QPls0FzM0q6wCPFC1OL9k67tBZ0lv20taLyKxRyh//8QAIhEA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VUUrStOE9QO/bFYKKcaSu13AJrADgOKyV1Uov20MRwXp65qXb4Jgii6vhT7L6zgMP4R\r\nVbGaEqsTHyf/2Q==\r\n\r\n",
"AllowRemoteContent": true,
"sha1": "c4522c8b1a011a75fb702d9c96a9c4929582bfa4"
} \ No newline at end of file
diff --git a/test/synckolab/parser/kolab2/raw/contactFullTest.eml b/test/synckolab/parser/kolab2/raw/contactFullTest.eml
index bbfabdf..8f58cc0 100644
--- a/test/synckolab/parser/kolab2/raw/contactFullTest.eml
+++ b/test/synckolab/parser/kolab2/raw/contactFullTest.eml
@@ -17,7 +17,7 @@ To view this object you will need an email client that can understand the Kolab
For a list of such email clients please visit
http://www.kolab.org/kolab2-clients.html
---Boundary-00=6988F02CCC809628
+--nextPart38186565.1WqI9LYOEs
Content-Type: application/x-vnd.kolab.contact;
name="kolab.xml"
Content-Transfer-Encoding: quoted-printable
@@ -95,4 +95,5 @@ note with öäü!</body>
<custom3>cust3</custom3>
<allow-remote-content>true</allow-remote-content>
</contact>
---Boundary-00=6988F02CCC809628-- \ No newline at end of file
+
+--nextPart38186565.1WqI9LYOEs-- \ No newline at end of file
diff --git a/test/synckolab/parser/kolab2/raw/contactMinimalTest.eml b/test/synckolab/parser/kolab2/raw/contactMinimalTest.eml
index 675157d..e8d14dd 100644
--- a/test/synckolab/parser/kolab2/raw/contactMinimalTest.eml
+++ b/test/synckolab/parser/kolab2/raw/contactMinimalTest.eml
@@ -17,7 +17,7 @@ To view this object you will need an email client that can understand the Kolab
For a list of such email clients please visit
http://www.kolab.org/kolab2-clients.html
---Boundary-00=6988F02CCC809628
+--nextPart38186565.1WqI9LYOEs
Content-Type: application/x-vnd.kolab.contact;
name="kolab.xml"
Content-Transfer-Encoding: quoted-printable
@@ -40,4 +40,5 @@ Content-Disposition: attachment;
</email>
<allow-remote-content>true</allow-remote-content>
</contact>
---Boundary-00=6988F02CCC809628-- \ No newline at end of file
+
+--nextPart38186565.1WqI9LYOEs--
diff --git a/test/synckolab/parser/kolab2/raw/testcontact.eml b/test/synckolab/parser/kolab2/raw/testcontact.eml
index c3343c7..c110cf5 100644
--- a/test/synckolab/parser/kolab2/raw/testcontact.eml
+++ b/test/synckolab/parser/kolab2/raw/testcontact.eml
@@ -21,7 +21,7 @@ http://www.kolab.org/kolab2-clients.html
--Boundary-00=173882C61DEE82C7
Content-Type: application/x-vnd.kolab.contact;
name="kolab.xml"
-Content-Transfer-Encoding: base64
+Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="kolab.xml"
diff --git a/test/synckolab/parser/kolab3/calendarTest.js b/test/synckolab/parser/kolab3/calendarTest.js
index e3c912b..a5f64be 100644
--- a/test/synckolab/parser/kolab3/calendarTest.js
+++ b/test/synckolab/parser/kolab3/calendarTest.js
@@ -21,7 +21,7 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
print("INFO: KOLAB 3 TESTING - EVENT: " + src +"\n")
content = readFile("test/synckolab/parser/kolab3/raw/"+src);
- content = synckolab.tools.stripMailHeader(content);
+ content = synckolab.tools.parseMail(content);
entry = synckolab.calendarTools.message2json(content, false);
content = readFile("test/synckolab/parser/kolab3/json/"+src+".json");
jsonEntry = JSON.parse(content);
@@ -42,7 +42,7 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
var src = testFiles[i];
content = readFile("test/synckolab/parser/kolab3/raw/"+src);
- content = synckolab.tools.stripMailHeader(content);
+ content = synckolab.tools.parseMail(content);
print(content);
print("==== STARTING PARSE")
entry = synckolab.calendarTools.message2json(content, false);
diff --git a/test/synckolab/parser/kolab3/contactTest.js b/test/synckolab/parser/kolab3/contactTest.js
index 3a66a08..b24dc69 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", "list.test1.eml"];
+ var testFiles = ["contact.test3.mime", "contact.simple.mime","contact.complex.mime","contact.test.mime","contact.test2.mime", "list.test1.eml"];
var content, entry, jsonEntry;
@@ -20,7 +20,7 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
var src = testFiles[i];
print("INFO: KOLAB 3 TESTING - CONTACT: " + src +"\n")
content = readFile("test/synckolab/parser/kolab3/raw/"+src);
- content = synckolab.tools.stripMailHeader(content);
+ content = synckolab.tools.parseMail(content);
entry = synckolab.addressbookTools.parseMessageContent(content);
content = readFile("test/synckolab/parser/kolab3/json/"+src+".json");
jsonEntry = JSON.parse(content);
@@ -32,6 +32,9 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
} else {
content = synckolab.addressbookTools.card2Kolab3(entry);
}
+ if(content.content) {
+ content = content.content;
+ }
xmlcontent = readFile("test/synckolab/parser/kolab3/xml/"+src + ".xml");
if (xmlcontent.replace(/[\n\r\t ]/g, "").length !== content.replace(/[\n\r\t ]/g, "").length) {
equal(xmlcontent.replace(/[\n\r\t ]/g, ""), content.replace(/[\n\r\t ]/g, ""), src);
@@ -47,7 +50,7 @@ for(var i = 0; i < testFiles.length; i++) {
var src = testFiles[i];
print("KOLAB 3 TESTING: " + src +"\n============")
content = readFile("test/synckolab/parser/kolab3/raw/"+src);
- content = synckolab.tools.stripMailHeader(content);
+ content = synckolab.tools.parseMail(content);
entry = synckolab.addressbookTools.parseMessageContent(content);
if(entry.isMailList) {
print(entry.toSource());
@@ -68,7 +71,7 @@ for(var i = 0; i < testFiles.length; i++) {
print("DIFF FOUND:"+ xmlcontent.replace(/[\n\r\t ]/g, "").length + " vs. "+ content.replace(/[\n\r\t ]/g, "").length +"\n" + diff);
}
}
-*/
+
/*
var testFiles = ["list.test1.eml"];
@@ -79,7 +82,7 @@ for(var i = 0; i < testFiles.length; i++) {
var src = testFiles[i];
content = readFile("test/synckolab/parser/kolab3/raw/"+src);
- content = synckolab.tools.stripMailHeader(content);
+ content = synckolab.tools.parseMail(content);
print(content);
print("==== STARTING PARSE")
entry = synckolab.addressbookTools.parseMessageContent(content);
diff --git a/test/synckolab/parser/kolab3/json/contact.complex.mime.json b/test/synckolab/parser/kolab3/json/contact.complex.mime.json
index c2cb6d0..eb613e6 100644
--- a/test/synckolab/parser/kolab3/json/contact.complex.mime.json
+++ b/test/synckolab/parser/kolab3/json/contact.complex.mime.json
@@ -5,14 +5,14 @@
"ts": 1349565039427,
"UUID": "urn:uuid:Huu5X7hfYy",
"DisplayName": "Displayname",
- "FirstName": "Lastname",
- "LastName": "Firstname",
+ "FirstName": "Firstname",
+ "LastName": "Lastname",
"Notes": "Notes",
"JobTitle": "Title",
"Profession": "Profession",
"PhotoName": "photo.png",
"PhotoType": "inline",
- "PhotoData": "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOTQAADpwB3vacVwAABAVJREFUeJztncFrFGcYxt/szLrJmk2yWTeojQktQluiqNFeKglSQmsOHhRyUApKPbeHQC8taKl4E0Hw4sGToAcvgojVQCg0B+2ph0DprTlYs7SQsNlkdzKzmf4DzxvYsCRP9Pkdn5n53iG/fPDy7TczZkIIIYQQov107PQNtI0vrR/mOfveveap/eAcSXeqRsYdSOwIEkKGhJAhIWRICBkSQsbua3u/slEUj346OoPyUrGEW1Uzm5mfycMDNRtB8ciHIy9RXswXi16NuYU5XOOx1VGsGUKGhJAhIWRICBkSQka40zfgcs6uoHjis4l7KB8fG8+ifPa3Wb9GZJdRPHZq7A7KTx45CWu8/uO1X6NFNEPIkBAyJIQMCSFDQsjYni4rxWtmnVOdsGMyM5s8PfkNyocPDwcor1QrcJwoiNzbOvvF2bsoL5fKsMZidRGOU7OaW6NVNEPIkBAyJIQMCSFDQshob5flbCTr/br3BcrPjJ854Q2V78/DTudt9S08P7YY5uXhslfC4jjGNdZwjaSewHwtXHNrtIpmCBkSQoaEkCE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Pqevg5ig8ePPALynu7e72tdfbnk3m8je54eArF+8v7n6G8mOnza7xwaugbVLsDCSFDQsiQEDIkhAwJIWP3tb0eNw2+MTnoyl7zLmlOx985h/DvwV6Nnk1qfNtaDc0QMiSEDAkhQ0LIkBAhhBBCCPEe8D+b5dDLeP4TXAAAAABJRU5ErkJggg==",
"WebPage1": "www.homepage.org",
"WebPage2": "www.blog.test",
"HomeAddress": "Home Street",
diff --git a/test/synckolab/parser/kolab3/json/contact.simple.mime.json b/test/synckolab/parser/kolab3/json/contact.simple.mime.json
index 6e779b9..d330f4e 100644
--- a/test/synckolab/parser/kolab3/json/contact.simple.mime.json
+++ b/test/synckolab/parser/kolab3/json/contact.simple.mime.json
@@ -5,8 +5,8 @@
"ts": 1349536624864,
"UUID": "urn:uuid:4xuyC0cyjV",
"DisplayName": "Volker Krause",
- "FirstName": "Krause",
- "LastName": "Volker",
+ "FirstName": "Volker",
+ "LastName": "Krause",
"PrimaryEmail": "vkrause@kde.org",
"sha1": "b93a56ffad8ad756d72ca9aae70f49e4bd85ecb8"
} \ No newline at end of file
diff --git a/test/synckolab/parser/kolab3/json/contact.test.mime.json b/test/synckolab/parser/kolab3/json/contact.test.mime.json
index bff573d..d8aa331 100644
--- a/test/synckolab/parser/kolab3/json/contact.test.mime.json
+++ b/test/synckolab/parser/kolab3/json/contact.test.mime.json
@@ -5,8 +5,8 @@
"ts": 1349900866998,
"UUID": "urn:uuid:e79e08cc-0f02-11e2-9e3c-000476ed9009",
"DisplayName": "firstname lastname",
- "FirstName": "lastname",
- "LastName": "firstname",
+ "FirstName": "firstname",
+ "LastName": "lastname",
"Notes": "multi line\nnotes\n\nwith empty",
"HomeAddress": "homestreet",
"HomeAddress2": "",
diff --git a/test/synckolab/parser/kolab3/json/contact.test2.mime.json b/test/synckolab/parser/kolab3/json/contact.test2.mime.json
index 7c35a9a..6c08d2f 100644
--- a/test/synckolab/parser/kolab3/json/contact.test2.mime.json
+++ b/test/synckolab/parser/kolab3/json/contact.test2.mime.json
@@ -5,8 +5,8 @@
"ts": 1349900714929,
"UUID": "urn: uuid:ebf6fdc2-1149-11e2-841b-000476ed9009",
"DisplayName": "Hans Wurst",
- "FirstName": "Wurst",
- "LastName": "Hans",
+ "FirstName": "Hans",
+ "LastName": "Wurst",
"HomePhone": "+49123456789",
"PrimaryEmail": "hans@wurst.de",
"sha1": "c4ea78596ac0cf988a5d6dac68f1510b9ef66b13"
diff --git a/test/synckolab/parser/kolab3/json/contact.test3.mime.json b/test/synckolab/parser/kolab3/json/contact.test3.mime.json
new file mode 100644
index 0000000..d16e37c
--- /dev/null
+++ b/test/synckolab/parser/kolab3/json/contact.test3.mime.json
@@ -0,0 +1 @@
+{"synckolab":"2.9.0","type":"contact","isMailList":false,"ts":1351269299411,"UUID":"urn:uuid:pas-id-A4E937D838A897AD","DisplayName":"cont2#öüä&$","PrimaryEmail":"weird@email.com","PreferMailFormat":0,"AllowRemoteContent":true,"sha1":"f1b30ff3264e645934db12e2894016a83916af8b"} \ No newline at end of file
diff --git a/test/synckolab/parser/kolab3/raw/contact.complex.mime b/test/synckolab/parser/kolab3/raw/contact.complex.mime
index 4a3d52a..54ade78 100644
--- a/test/synckolab/parser/kolab3/raw/contact.complex.mime
+++ b/test/synckolab/parser/kolab3/raw/contact.complex.mime
@@ -84,7 +84,7 @@ CBkSQoaEkJE2M++8vn+OvwNMTw9fhw3ZPdyh5e1lJVVxGp3XClK/wrwwFv6dUOTrpBGcRDO=
EDAkhQ0LIkBAyJISMpHt7z5QwF+Or4LrwDW3NMt5/2rvv3ANiZmFXGn4gh6bxpbqZEXxNRp=
CJhr0a7aIZQoaEkCEhZEgIGRJChoSQQbvsrZb/gA987Jb6fkL5fiX6FOV3y7kvvBoDqTQ8R=
TezY2+hvK8/WEJ52Ki3d1tyApohZEgIGRJChoSQISFk0K6yPto4gGf/l5cP/N/RaB/n2QaD=
-vyT28dIcPvQ2sNnjl9C9vecaCSFDQsiQEDIkhIx/AF4jzh2wCYImAAAAAElFTkSuQmCC</u=
+vyT28dIcPvQ2sNnjl9C9vecaCSFDQsiQEDIkhIx/AF4jzh2wCYImAAAAAElFTkSuQmCC==</u=
ri>
</logo>
<related>
diff --git a/test/synckolab/parser/kolab3/raw/contact.test3.mime b/test/synckolab/parser/kolab3/raw/contact.test3.mime
new file mode 100644
index 0000000..849a35a
--- /dev/null
+++ b/test/synckolab/parser/kolab3/raw/contact.test3.mime
@@ -0,0 +1,50 @@
+From: niko.berger@corinis.com
+Reply-To:
+Bcc:
+To: synckolab@no.tld
+Subject: urn:uuid:pas-id-A4E937D838A897AD
+Date: Fri, 26 Oct 2012 17:25:49 +0200
+Content-Type: Multipart/Mixed;boundary="Boundary-00=D2A398834E826D6C"
+User-Agent: SyncKolab 2.9.0
+X-Kolab-Type: application/vcard+xml
+
+--Boundary-00=D2A398834E826D6C
+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://kolab.org/content/kolab-clients
+---
+Name: cont2#&$
+E-Mail:weird@email.com
+---
+
+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=D2A398834E826D6C
+Content-Type: application/vcard+xml;
+ name="kolab.xml"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+ filename="kolab.xml"
+
+PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/
+Pgo8dmNhcmRzIHhtbG5zPSJ1cm46aWV0ZjpwYXJhbXM6eG1sOm5zOnZjYXJkLTQuMCI+Cjx2
+Y2FyZD4KIDx1aWQ+PHVyaT51cm46dXVpZDpwYXMtaWQtQTRFOTM3RDgzOEE4OTdBRDwvdXJp
+PjwvdWlkPgogPHgta29sYWItdmVyc2lvbj48dGV4dD4zLjBkZXYxPC90ZXh0PjwveC1rb2xh
+Yi12ZXJzaW9uPgogPHByb2RpZD48dGV4dD5TeW5jS29sYWIgMi45LjAsIEtvbGFiIHJlc291
+cmNlPC90ZXh0PjwvcHJvZGlkPgogPHJldj48dGltZXN0YW1wPjE5NzAwMTAxVDAwMDAwMFpa
+PC90aW1lc3RhbXA+PC9yZXY+CiA8a2luZD48dGV4dD5pbmRpdmlkdWFsPC90ZXh0Pjwva2lu
+ZD4KICA8Zm4+PHRleHQ+Y29udDIjw7bDvMOkJmFtcDskPC90ZXh0PjwvZm4+CiA8ZW1haWw+
+CiAgPHBhcmFtZXRlcnM+PHByZWY+PGludGVnZXI+MTwvaW50ZWdlcj48L3ByZWY+PC9wYXJh
+bWV0ZXJzPgogIDx0ZXh0PndlaXJkQGVtYWlsLmNvbTwvdGV4dD4KIDwvZW1haWw+Cjx4LWN1
+c3RvbT48aWRlbnRpZmllcj5YLVByZWZlck1haWxGb3JtYXQ8L2lkZW50aWZpZXI+PHZhbHVl
+PnVua25vd248L3ZhbHVlPjwveC1jdXN0b20+CiA8eC1jdXN0b20+PGlkZW50aWZpZXI+WC1B
+bGxvd1JlbW90ZUNvbnRlbnQ8L2lkZW50aWZpZXI+PHZhbHVlPnRydWU8L3ZhbHVlPjwveC1j
+dXN0b20+CjwvdmNhcmQ+CjwvdmNhcmRzPgo=
+
+--Boundary-00=D2A398834E826D6C--
diff --git a/test/synckolab/parser/kolab3/xml/contact.complex.mime.xml b/test/synckolab/parser/kolab3/xml/contact.complex.mime.xml
index 1892809..193c291 100644
--- a/test/synckolab/parser/kolab3/xml/contact.complex.mime.xml
+++ b/test/synckolab/parser/kolab3/xml/contact.complex.mime.xml
@@ -8,8 +8,8 @@
<kind><text>individual</text></kind>
<fn><text>Displayname</text></fn>
<n>
- <surname>Firstname</surname>
- <given>Lastname</given>
+ <surname>Lastname</surname>
+ <given>Firstname</given>
</n>
<note>
<text>Notes</text>
@@ -70,7 +70,7 @@ IUt0Z9/7qv7bVKXME74jIbeLXQ+SU6zKjLemeREDIkhAwJIUNCyNieN8p14NWhutUuepdEP
zVeofxQbugWyivVRa/78r8A8Zf9CPOBzA0U70lC+PcK0qBtX5nQDCFDQsiQEDIkhAwJIWP3
fYPqevg5ig8ePPALynu7e72tdfbnk3m8je54eArF+8v7n6G8mOnza7xwaugbVLsDCSFDQsi
QEDIkhAwJIWP3tb0eNw2+MTnoyl7zLmlOx985h/DvwV6Nnk1qfNtaDc0QMiSEDAkhQ0LIkB
-AhhBBCCPEe8D+b5dDLeP4TXAAAAABJRU5ErkJggg</uri>
+AhhBBCCPEe8D+b5dDLeP4TXAAAAABJRU5ErkJggg==</uri>
</photo>
<tel>
<parameters><type><text>home</text></type></parameters>
@@ -99,6 +99,7 @@ AhhBBCCPEe8D+b5dDLeP4TXAAAAABJRU5ErkJggg</uri>
<text>second@email.org</text>
</email>
<x-custom><identifier>Profession</identifier><value>Profession</value></x-custom>
+ <x-custom><identifier>X-PreferMailFormat</identifier><value>unknown</value></x-custom>
<x-custom><identifier>X-AllowRemoteContent</identifier><value>true</value></x-custom>
</vcard>
</vcards> \ No newline at end of file
diff --git a/test/synckolab/parser/kolab3/xml/contact.simple.mime.xml b/test/synckolab/parser/kolab3/xml/contact.simple.mime.xml
index 36fe656..b507b69 100644
--- a/test/synckolab/parser/kolab3/xml/contact.simple.mime.xml
+++ b/test/synckolab/parser/kolab3/xml/contact.simple.mime.xml
@@ -17,6 +17,7 @@
<parameters><pref><integer>1</integer></pref></parameters>
<text>vkrause@kde.org</text>
</email>
+ <x-custom><identifier>X-PreferMailFormat</identifier><value>unknown</value></x-custom>
<x-custom><identifier>X-AllowRemoteContent</identifier><value>false</value></x-custom>
</vcard>
</vcards> \ No newline at end of file
diff --git a/test/synckolab/parser/kolab3/xml/contact.test.mime.xml b/test/synckolab/parser/kolab3/xml/contact.test.mime.xml
index 19e7b22..77eba92 100644
--- a/test/synckolab/parser/kolab3/xml/contact.test.mime.xml
+++ b/test/synckolab/parser/kolab3/xml/contact.test.mime.xml
@@ -36,6 +36,7 @@ with empty</text>
<code>1234</code>
<country>homecountry</country>
</adr>
+ <x-custom><identifier>X-PreferMailFormat</identifier><value>unknown</value></x-custom>
<x-custom><identifier>X-AllowRemoteContent</identifier><value>false</value></x-custom>
</vcard>
</vcards> \ No newline at end of file
diff --git a/test/synckolab/parser/kolab3/xml/contact.test2.mime.xml b/test/synckolab/parser/kolab3/xml/contact.test2.mime.xml
index 5a92b9b..8ecf7d8 100644
--- a/test/synckolab/parser/kolab3/xml/contact.test2.mime.xml
+++ b/test/synckolab/parser/kolab3/xml/contact.test2.mime.xml
@@ -21,6 +21,7 @@
<parameters><pref><integer>1</integer></pref></parameters>
<text>hans@wurst.de</text>
</email>
+ <x-custom><identifier>X-PreferMailFormat</identifier><value>unknown</value></x-custom>
<x-custom><identifier>X-AllowRemoteContent</identifier><value>false</value></x-custom>
</vcard>
</vcards> \ No newline at end of file
diff --git a/test/synckolab/parser/kolab3/xml/contact.test3.mime.xml b/test/synckolab/parser/kolab3/xml/contact.test3.mime.xml
new file mode 100644
index 0000000..52d2ebb
--- /dev/null
+++ b/test/synckolab/parser/kolab3/xml/contact.test3.mime.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<vcards xmlns="urn:ietf:params:xml:ns:vcard-4.0">
+<vcard>
+ <uid><uri>urn:uuid:pas-id-A4E937D838A897AD</uri></uid>
+ <x-kolab-version><text>3.0dev1</text></x-kolab-version>
+ <prodid><text>SyncKolab 2.9.0, Kolab resource</text></prodid>
+ <rev><timestamp>19700101T000000ZZ</timestamp></rev>
+ <kind><text>individual</text></kind>
+ <fn><text>cont2#öüä&amp;$</text></fn>
+ <email>
+ <parameters><pref><integer>1</integer></pref></parameters>
+ <text>weird@email.com</text>
+ </email>
+ <x-custom><identifier>X-PreferMailFormat</identifier><value>unknown</value></x-custom>
+ <x-custom><identifier>X-AllowRemoteContent</identifier><value>true</value></x-custom>
+</vcard>
+</vcards>
diff --git a/test/synckolab/tools/data/multipart.eml b/test/synckolab/tools/data/multipart.eml
new file mode 100644
index 0000000..d181b2a
--- /dev/null
+++ b/test/synckolab/tools/data/multipart.eml
@@ -0,0 +1,74 @@
+Date: Fri, 27 Apr 2012 16:58:49 +0200
+X-Kolab-Type: application/x-vnd.kolab.task
+X-Kolab-Mime-Version: 3.0
+User-Agent: Libkolab-0.2.0
+Content-Type: multipart/mixed; boundary="nextPart1676922.i4WXLoZAWe"
+Subject: KOrganizer-396756838.184
+MIME-Version: 1.0
+
+
+--nextPart1676922.i4WXLoZAWe
+Content-Type: text/plain; charset="us-ascii"
+Content-Transfer-Encoding: 7Bit
+
+plaintext-part1
+
+--nextPart1676922.i4WXLoZAWe
+Content-Type: application/calendar+xml; name="kolab.xml"
+Content-Transfer-Encoding: quoted-printable
+Content-Disposition: attachment; filename="kolab.xml"
+
+<?xml version=3D"1.0" encoding=3D"UTF-8" standalone=3D"no" ?>
+<xml>
+ <part>2</part>
+</xml>
+
+--nextPart1676922.i4WXLoZAWe
+Content-ID: <2838853.9Y25si6h6e@kolab.resource.akonadi>
+Content-Type: image/png; name="akonadi.png"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="akonadi.png"
+
+iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A
+/wD/oL2nkwAAAAlwSFlzAAAbrwAAG68BXhqRHAAAAAd0SU1FB9gFEQkdFPibCIYAAAMrSURBVDjL
+pZNLaBx1AMZ/M/P/78zOzO7ObDbvNUnTxsUUm6YmaulNxN70UKEIRTyIBy8KHrypRUTw4Ek8CqKn
+XuyhHgQRFTRNAvVFbOnDNO/EfWZmdmczszPrwcdBvPnBd/ng98F3+OB/Svl3cPbSx5mZ+ZkXjKx+
+setHs4cHbaW+7d2s79SvhK29j+6vvXH0nwVPfLh1WsTptdnxuDDxoGv3NZWuf4S3G1C722BrrcrO
+nY1f/ebO05s337n3N6cBLLy1bI7njr4uD4nJhx4by5SGLQYcAzWnI6SGVFUkQKwMRqH/jGHNfXJY
+XwoBBMDc/MhLThpOJ6ZEMzM4moquQpIVxI5Br5QlHrEImw5xuzRJ0n4beBlABRgwxcXhUp5Ww6OX
+QvCXo/TPjUJq6FmJldPJOTZ2znj++HOfnwQQ0y9+e67X6iykpmTCNTnY9xBjeTQVelFC0u3RjxNI
++6iaQiajYtmGlXa6NxZe/f4pobv24/X9thBSYebUEHc26zT6kLMkaZTQ84+IvYioE9PrRvTTCBSF
+2PczUTxyVuiOsXHju58Y0XTaQcTJM0OsXt9kaqqIrinEQUTYCPGrAR2vRbcbELS7ZGWEj72hzL+5
+MqS0uzvBys/CzbsUxx0KJROvnTBZLtCPU/y6j1erE/g1wrBNdqREWKwktdB4QP3h8qO/K6Z2RR8b
+JmjtUx7KMDtd4MSozuatXX5Zus3tH29Rre7S18GtjFNanAMpr37w2ti+ABAyeT0eLJ7vtWoDX1z9
+BiXV0DRJmqakSRfd1iiMOmSPjeKeqVC/H3oPT8r3ZNyzVID3L1V2nDzPqsPlQ2PiGKoJCQFJ4qPI
+FH0gh3P6ONlHKlQ3ve6EEb57fl7GSh9DAVjaqmrNRsv97Kv1xeurjcthkCyqURs7JzBdE6NokQgJ
+SbQ+O65+euqEszo4UPytWMhvCwBUkSqq1jk356xNDUevLK/sPbl+L7jQ8ZLyUaepGE1xMDZhfDlb
+KSwPFt1tXcp9qWk1VWjhP2e6dneLvhdqLc/L7B3UzfX1qttsdfKKguo4ZlguO36xWAgLth3mbSsy
+TatnyFz6B+BnWV0A/UiAAAAAAElFTkSuQmCC
+
+--nextPart1676922.i4WXLoZAWe
+Content-ID: <2222@kolab.resource.akonadi>
+Content-Type: image/png; name="akonadi2.png"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="akonadi2.png"
+
+iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A
+/wD/oL2nkwAAAAlwSFlzAAAbrwAA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qWk1VWjhP2e6dneLvhdqLc/L7B3UzfX1qttsdfKKguo4ZlguO36xWAgLth3mbSsy
+TatnyFz6B+BnWV0A/UiAAAAAAElFTkSuQmCC
+
+--nextPart1676922.i4WXLoZAWe--
diff --git a/test/synckolab/tools/toolsTest.js b/test/synckolab/tools/toolsTest.js
index 7d4770c..47517a8 100644
--- a/test/synckolab/tools/toolsTest.js
+++ b/test/synckolab/tools/toolsTest.js
@@ -26,13 +26,26 @@ test("synckolab.Node", function(){
});
+test("synckolab.tools.parseMail", function(){
+ var message = readFile("test/synckolab/tools/data/multipart.eml");
+ message = synckolab.tools.parseMail(message);
+ equal(message.content.replace(/[\r\n ]+/g, ""), ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>" +
+"<xml>" +
+" <part>2</part>" +
+"</xml>").replace(/[\r\n ]+/g, ""), "content");
+ equal(2, message.parts.length, "2 attachments");
+ equal(message.parts[0].id, "2838853.9Y25si6h6e@kolab.resource.akonadi", "content id of attchment 1");
+ equal(message.parts[0].name, "akonadi.png", "name of attchment 1");
+ equal(message.parts[1].id, "2222@kolab.resource.akonadi", "content id of attchment 2");
+ equal(message.parts[1].name, "akonadi2.png", "name of attchment 2");
+});
/**
* Test uuencoded message
*/
test("synckolab.tools.uudecode", function(){
var message = readFile("test/synckolab/tools/data/uutest1.eml");
- message = synckolab.tools.stripMailHeader(message);
+ message = synckolab.tools.parseMail(message);
equal(message.content.replace(/[\r\n]+/g, " "), ("BEGIN:VCARD " +
"VERSION:3.0 " +
"PRODID:-//kerio.com/Contacts//NONSGML v1.0//EN " +
@@ -56,7 +69,7 @@ test("synckolab.tools.uudecode", function(){
*/
test("synckolab.tools.quoteddecode", function(){
var message = readFile("test/synckolab/tools/data/quotedtest1.eml");
- message = synckolab.tools.stripMailHeader(message);
+ message = synckolab.tools.parseMail(message);
equal(message.content.replace(/[ \r\n]+/g, ""), ("BEGIN:VCALENDAR" +
"PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN " +
"VERSION:2.0 " +
@@ -74,5 +87,5 @@ test("synckolab.tools.quoteddecode", function(){
/*
var content = readFile("test/synckolab/tools/data/uutest1.eml");
-print(synckolab.tools.stripMailHeader(content));
+print(synckolab.tools.parseMail(content));
*/ \ No newline at end of file