summaryrefslogtreecommitdiffstats
path: root/tests/api/test_noargs.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/api/test_noargs.py')
-rw-r--r--tests/api/test_noargs.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/api/test_noargs.py b/tests/api/test_noargs.py
new file mode 100644
index 000000000..12da0b417
--- /dev/null
+++ b/tests/api/test_noargs.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+
+import inspect
+
+from ApiTester import ApiTester
+
+from module.remote.apitypes import Iface
+
+IGNORE = ('quit', 'restart')
+
+class TestNoArgs(ApiTester):
+ def setUp(self):
+ self.enableJSON()
+
+# Setup test_methods dynamically, only these which require no arguments
+for name in dir(Iface):
+ if name.startswith("_") or name in IGNORE: continue
+
+ spec = inspect.getargspec(getattr(Iface, name))
+ if len(spec.args) == 1 and (not spec.varargs or len(spec.varargs) == 0):
+ def meta_test(name): #retain local scope
+ def test(self):
+ getattr(self.api, name)()
+ test.func_name = "test_%s" % name
+ return test
+
+ setattr(TestNoArgs, "test_%s" % name, meta_test(name))
+
+ del meta_test \ No newline at end of file