[conduit/syncml: 3/244] Start stubbing out a syncml test



commit 539678c7e975f9c13012d12bb5d68de1d70db479
Author: John Carr <john carr unrouted co uk>
Date:   Mon Apr 6 09:50:52 2009 -0700

    Start stubbing out a syncml test
---
 test/python-tests/TestSyncml.py |   44 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/test/python-tests/TestSyncml.py b/test/python-tests/TestSyncml.py
new file mode 100644
index 0000000..cb6ee20
--- /dev/null
+++ b/test/python-tests/TestSyncml.py
@@ -0,0 +1,44 @@
+import subprocess
+import signal
+import os
+import time
+
+server = subprocess.Popen(["syncml-ds-tool", "--sync", "text/x-vcard", "contacts", "contacts", "--http-server", "1234"])
+
+# no way to tell syncml-ds-tool is running :(
+time.sleep(1)
+
+#common sets up the conduit environment
+from common import *
+
+import conduit.datatypes.File as File
+import conduit.utils as Utils
+
+#setup the conduit
+test = SimpleSyncTest()
+sourceW = test.get_dataprovider("SyncmlContactTwoWay")
+sinkW = test.get_dataprovider("FolderTwoWay")
+test.prepare(sourceW, sinkW)
+test.set_two_way_policy({"conflict":"ask","deleted":"ask"})
+
+#configure the source and sink
+config = {}
+config["folder"] = "file://"+Utils.new_tempdir()
+config["folderGroupName"] = "Tomboy"
+test.configure(sink=config)
+
+#check they refresh ok
+test.refresh()
+a = test.get_source_count()
+ok("Got notes to sync (%s)" % a, a > 0)
+
+#sync
+test.set_two_way_sync(True)
+a,b = test.sync()
+abort,error,conflict = test.get_sync_result()
+ok("Sync completed", abort == False)
+ok("All notes transferred (%s,%s)" % (a,b), a == b)
+
+finished()
+
+os.kill(server.pid, signal.SIGINT)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]