summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniko <niko>2012-10-17 23:15:14 (GMT)
committerniko <niko>2012-10-17 23:15:14 (GMT)
commit529d1b4304aa3bd87414c28ffaeae0b19a44f0f2 (patch)
treec751815e547b7b99a1de692bb98c17e2ff92e99b
parent397080338185118728c46f9bd09a92ec72f163c9 (diff)
downloadsynckolab-529d1b4304aa3bd87414c28ffaeae0b19a44f0f2.tar.gz
kolab2 dist lists
-rw-r--r--test/synckolab/parser/kolab2/contactTest.js15
-rw-r--r--test/synckolab/parser/kolab2/raw/list.test.xml4
-rw-r--r--test/synckolab/parser/kolab2/xml/contactFullTest.xml71
-rw-r--r--test/synckolab/parser/kolab2/xml/contactMinimalTest.xml17
-rw-r--r--test/synckolab/parser/kolab2/xml/list.test.xml21
-rw-r--r--test/synckolab/parser/kolab3/contactTest.js5
-rw-r--r--test/synckolab/parser/kolab3/xml/list.test1.eml.xml13
7 files changed, 135 insertions, 11 deletions
diff --git a/test/synckolab/parser/kolab2/contactTest.js b/test/synckolab/parser/kolab2/contactTest.js
index d1fa937..d247613 100644
--- a/test/synckolab/parser/kolab2/contactTest.js
+++ b/test/synckolab/parser/kolab2/contactTest.js
@@ -26,6 +26,21 @@ test("skolab2 ynckolab.addressbookTools.parseMessageContent", function(){
jsonEntry = JSON.parse(content);
equal(synckolab.tools.equalsObject(entry, jsonEntry), true, src + "\n" + JSON.stringify(entry, null, " "));
+ // json -> kolab 2 xml
+ /*
+ if(entry.type === "maillist") {
+ content = synckolab.addressbookTools.list2Xml(entry);
+ } else {
+ content = synckolab.addressbookTools.card2Xml(entry);
+ }
+ xmlcontent = readFile("test/synckolab/parser/kolab2/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);
+ var diff = diffString(xmlcontent, content);
+ print("DIFF FOUND:"+ xmlcontent.replace(/[\n\r\t ]/g, "").length + " vs. "+ content.replace(/[\n\r\t ]/g, "").length +"\n" + diff);
+ }
+ */
+
}
diff --git a/test/synckolab/parser/kolab2/raw/list.test.xml b/test/synckolab/parser/kolab2/raw/list.test.xml
index 6aece4e..9f07b00 100644
--- a/test/synckolab/parser/kolab2/raw/list.test.xml
+++ b/test/synckolab/parser/kolab2/raw/list.test.xml
@@ -3,8 +3,8 @@
<product-id>SyncKolab, Kolab resource</product-id>
<uid>list_name</uid>
<creation-date>20121017T214612Z</creation-date>
- <last-modification-date>20121017T214612Z</last-modification-date>
- <sensitivity>public</sensitivity>
+ <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
+ <sensitivity>public</sensitivity>
<name>list-name</name>
<body>list-description</body>
<nickname>list-nickname</nickname>
diff --git a/test/synckolab/parser/kolab2/xml/contactFullTest.xml b/test/synckolab/parser/kolab2/xml/contactFullTest.xml
new file mode 100644
index 0000000..895dfac
--- /dev/null
+++ b/test/synckolab/parser/kolab2/xml/contactFullTest.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<contact version="1.0" >
+ <product-id>SyncKolab, Kolab resource</product-id>
+ <uid>pas-id-1D84CEA337CD1878</uid>
+ <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
+ <sensitivity>public</sensitivity>
+ <body>multiline
+note with öäü!</body>
+ <name>
+ <given-name>testöä</given-name>
+ <last-name>lastnameöäü</last-name>
+ <full-name>testöä lastname</full-name>
+ </name>
+ <organization>w-org</organization>
+ <web-page>w-web</web-page>
+ <business-web-page>p-web</business-web-page>
+ <department>w-department</department>
+ <job-title>w-title</job-title>
+ <nick-name>nick</nick-name>
+ <birthday>1980-1-22</birthday>
+ <phone>
+ <type>home1</type>
+ <number>01-home</number>
+ </phone>
+ <phone>
+ <type>business1</type>
+ <number>01-work</number>
+ </phone>
+ <phone>
+ <type>fax</type>
+ <number>01-fax</number>
+ </phone>
+ <phone>
+ <type>mobile</type>
+ <number>01-mobile</number>
+ </phone>
+ <phone>
+ <type>page</type>
+ <number>01-page</number>
+ </phone>
+ <email type="primary">
+ <display-name>testöä lastname</display-name>
+ <smtp-address>email@mail.com</smtp-address>
+ </email>
+ <email>
+ <display-name>testöä lastname</display-name>
+ <smtp-address>additional@mail.com</smtp-address>
+ </email>
+ <address>
+ <type>home</type>
+ <street>priv-addr1</street>
+ <street2>priv-addr2</street2>
+ <locality>priv-city</locality>
+ <region>priv-state</region>
+ <postal-code>p123</postal-code>
+ <country>p-country</country>
+ </address>
+ <address>
+ <type>business</type>
+ <street>w-addr1</street>
+ <street2>w-addr2</street2>
+ <locality>w-city</locality>
+ <region>w-state</region>
+ <postal-code>w123</postal-code>
+ <country>w-country</country>
+ </address>
+ <custom1>cust1</custom1>
+ <custom2>cust2</custom2>
+ <custom3>cust3</custom3>
+ <allow-remote-content>true</allow-remote-content>
+</contact>
diff --git a/test/synckolab/parser/kolab2/xml/contactMinimalTest.xml b/test/synckolab/parser/kolab2/xml/contactMinimalTest.xml
new file mode 100644
index 0000000..29cc0ed
--- /dev/null
+++ b/test/synckolab/parser/kolab2/xml/contactMinimalTest.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<contact version="1.0" >
+ <product-id>SyncKolab, Kolab resource</product-id>
+ <uid>sk-vc-C18A6B3AE0CD9EDC</uid>
+ <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
+ <sensitivity>public</sensitivity>
+ <name>
+ <given-name>Test</given-name>
+ <last-name>LastName</last-name>
+ <full-name>Test Lastname</full-name>
+ </name>
+ <email type="primary">
+ <display-name>Test Lastname</display-name>
+ <smtp-address>email@test.com</smtp-address>
+ </email>
+ <allow-remote-content>true</allow-remote-content>
+</contact>
diff --git a/test/synckolab/parser/kolab2/xml/list.test.xml b/test/synckolab/parser/kolab2/xml/list.test.xml
new file mode 100644
index 0000000..d9575ac
--- /dev/null
+++ b/test/synckolab/parser/kolab2/xml/list.test.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<distribution-list version="1.0" >
+ <product-id>SyncKolab, Kolab resource</product-id>
+ <uid>list_name</uid>
+ <creation-date>20121017T231244Z</creation-date>
+ <last-modification-date>1970-01-01T00:00:00Z</last-modification-date>
+ <sensitivity>public</sensitivity>
+ <name>list-name</name>
+ <body>list-description</body>
+ <nickname>list-nickname</nickname>
+ <member>
+ <display-name>testöä lastname</display-name>
+ <smtp-address>weird@email.com</smtp-address>
+ <uid>urn:uuid:pas-id-1D84CEA337CD1878</uid>
+ </member>
+ <member>
+ <display-name>cont2#öüä&amp;$</display-name>
+ <smtp-address>weird@email.com</smtp-address>
+ <uid>urn:uuid:pas-id-A4E937D838A897AD</uid>
+ </member>
+</distribution-list>
diff --git a/test/synckolab/parser/kolab3/contactTest.js b/test/synckolab/parser/kolab3/contactTest.js
index 51f0044..d5030c7 100644
--- a/test/synckolab/parser/kolab3/contactTest.js
+++ b/test/synckolab/parser/kolab3/contactTest.js
@@ -33,8 +33,9 @@ test("kolab3 synckolab.addressbookTools.parseMessageContent", function(){
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)
+ 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);
+ var diff = diffString(xmlcontent, content);
print("DIFF FOUND:"+ xmlcontent.replace(/[\n\r\t ]/g, "").length + " vs. "+ content.replace(/[\n\r\t ]/g, "").length +"\n" + diff);
}
}
diff --git a/test/synckolab/parser/kolab3/xml/list.test1.eml.xml b/test/synckolab/parser/kolab3/xml/list.test1.eml.xml
index 464d2dd..3457c17 100644
--- a/test/synckolab/parser/kolab3/xml/list.test1.eml.xml
+++ b/test/synckolab/parser/kolab3/xml/list.test1.eml.xml
@@ -1,13 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <vcards xmlns="urn:ietf:params:xml:ns:vcard-4.0">
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<vcards xmlns="urn:ietf:params:xml:ns:vcard-4.0">
<vcard>
<uid><text>list_name</text></uid>
<x-kolab-version><text>3.0dev1</text></x-kolab-version>
<prodid><text>SyncKolab 3.0.0, Kolab resource</text></prodid>
- <rev><timestamp>19700101T000000ZZ</timestamp></rev>
- <kind>
- <text>group</text>
- </kind>
+ <rev><timestamp>20121017T224839ZZ</timestamp></rev>
+ <kind><text>group</text></kind>
<fn><text>list-name</text></fn>
<nickname><text>list-nickname</text></nickname>
<member>
@@ -22,4 +20,5 @@
</member>
<note><text>list-description</text></note>
</vcard>
-</vcards> \ No newline at end of file
+</vcards>
+