[conduit/syncml: 3/13] Extend and fix syncml soup testing
- From: John Carr <johncarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [conduit/syncml: 3/13] Extend and fix syncml soup testing
- Date: Sat, 27 Jun 2009 15:24:08 +0000 (UTC)
commit d9439249c358389d2730d85d448bcddf323ae931
Author: John Carr <john carr unrouted co uk>
Date: Fri May 22 17:21:36 2009 +0100
Extend and fix syncml soup testing
test/soup/modules/syncml.py | 36 +++++++++++++++++++++++++----
1 files changed, 31 insertions(+), 5 deletions(-)
---
diff --git a/conduit/modules/SyncmlModule/__init__.py b/conduit/modules/SyncmlModule/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/test/soup/modules/syncml.py b/test/soup/modules/syncml.py
index af7d175..a7cdfaf 100644
--- a/test/soup/modules/syncml.py
+++ b/test/soup/modules/syncml.py
@@ -4,20 +4,44 @@ import soup
from soup.data.contact import ContactWrapper
from soup.data.event import EventWrapper
-import conduit.modules.SyncmlModule as SyncmlModule
+import conduit.modules.SyncmlModule.SyncmlModule as SyncmlModule
import os
import subprocess
import signal
-server_path = os.path.join(soup.get_root(), "test", "python-tests", "syncml-server.sh")
+server_path = os.path.join(soup.get_root(), "test", "python-tests")
server_script = os.path.join(server_path, "syncml-server.sh")
-class SyncmlContacts(soup.modules.ModuleWrapper):
+class SyncmlBase(object):
+
+ def get_num_items(self):
+ num_objects = len([x for x in os.listdir(self.dir) if os.path.isfile(x)])
+ assert num_objects != 1
+ return num_objects - 1 if num_objects > 0 else 0
+
+ def get_all(self):
+ return [x for x in os.listdir(self.dir) if os.path.isfile(x)]
+
+ def get(self, uid):
+ return None
+
+ def add(self, obj):
+ pass
+
+ def replace(self, uid, obj):
+ pass
+
+ def delete(self, uid):
+ os.unlink(os.path.join(self.dir, uid))
+
+
+class SyncmlContacts(soup.modules.ModuleWrapper, SyncmlBase):
klass = SyncmlModule.SyncmlContactsTwoWay
dataclass = ContactWrapper
+ dir = os.path.join(server_path, "contacts")
def create_dataprovider(self):
self.server = subprocess.Popen([server_script, "text/x-vcard", "Contacts", "contacts"], cwd=server_path)
@@ -27,10 +51,11 @@ class SyncmlContacts(soup.modules.ModuleWrapper):
os.kill(self.server.pid, signal.SIGINT)
-class SyncmlCalendar(soup.modules.ModuleWrapper):
+class SyncmlCalendar(soup.modules.ModuleWrapper, SyncmlBase):
klass = SyncmlModule.SyncmlEventsTwoWay
- dataclass = EventsWrapper
+ dataclass = EventWrapper
+ dir = os.path.join(server_path, "calendar")
def create_dataprovider(self):
self.server = subprocess.Popen([server_script, "text/x-vcalendar", "Calendar", "calendar"], cwd=server_path)
@@ -38,3 +63,4 @@ class SyncmlCalendar(soup.modules.ModuleWrapper):
def destroy_dataprovider(self):
os.kill(self.server.pid, signal.SIGINT)
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]