summaryrefslogtreecommitdiffstats
path: root/tests/api/test_api.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/test_api.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/test_api.py')
-rw-r--r--tests/api/test_api.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/api/test_api.py b/tests/api/test_api.py
new file mode 100644
index 000000000..68448b891
--- /dev/null
+++ b/tests/api/test_api.py
@@ -0,0 +1,39 @@
+
+from unittest import TestCase
+from random import choice
+
+from pyLoadCore import Core
+
+from ApiTester import ApiTester
+
+class TestAPI(TestCase):
+ """
+ Test all available testers randomly and on all backends
+ """
+ core = None
+
+ @classmethod
+ def setUpClass(cls):
+ from test_noargs import TestNoArgs
+
+ cls.core = Core()
+ cls.core.start(False, False, True)
+ for Test in (TestNoArgs,):
+ t = Test()
+ t.enableJSON()
+ t = Test()
+ t.enableWS()
+ t = Test()
+ t.setApi(cls.core.api)
+
+ cls.methods = ApiTester.get_methods()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.core.shutdown()
+
+ def test_random(self, n=10000):
+
+ for i in range(n):
+ func = choice(self.methods)
+ func()