summaryrefslogtreecommitdiffstats
path: root/tests/api/ApiTester.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-10-13 21:39:58 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-10-13 21:39:58 +0200
commit7e7adc64713f74976d5994af36b5f758620fb37b (patch)
tree868084317f8818dbb327c76eaff3c7c7edce0231 /tests/api/ApiTester.py
parentfixed JsEngine init (diff)
downloadpyload-7e7adc64713f74976d5994af36b5f758620fb37b.tar.xz
added JSON and WS client, re organized tests, new classes for easier api tests
Diffstat (limited to 'tests/api/ApiTester.py')
-rw-r--r--tests/api/ApiTester.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/api/ApiTester.py b/tests/api/ApiTester.py
new file mode 100644
index 000000000..b17a7655e
--- /dev/null
+++ b/tests/api/ApiTester.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+
+from module.remote.JSONClient import JSONClient
+from module.remote.WSClient import WSClient
+
+from ApiProxy import ApiProxy
+
+class ApiTester:
+
+ tester= []
+
+ @classmethod
+ def register(cls, tester):
+ cls.tester.append(tester)
+
+ @classmethod
+ def get_methods(cls):
+ """ All available methods for testing """
+ methods = []
+ for t in cls.tester:
+ methods.extend(getattr(t, attr) for attr in dir(t) if attr.startswith("test_"))
+ return methods
+
+ def __init__(self):
+ ApiTester.register(self)
+ self.api = None
+
+ def setApi(self, api):
+ self.api = api
+
+ def enableJSON(self):
+ self.api = ApiProxy(JSONClient())
+
+ def enableWS(self):
+ self.api = ApiProxy(WSClient())