summaryrefslogtreecommitdiffstats
path: root/result_collection_api/tests/unit/test_base.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-05-17 21:05:27 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-05-17 21:12:20 +0800
commitd719f7428de763767b491b983ce214c329ba37b1 (patch)
treec5b4e7593d2223eed50581ec278ca20b010c076f /result_collection_api/tests/unit/test_base.py
parentf91356cf045f03f2c318821dd087f05670abb892 (diff)
add unittest framework for supporting unittest in testAPI
usage is shown in utils/test/result_collection_api/README.md JIRA: FUNCTEST-251 Change-Id: I788417e296c153cc485f4a4064697bdafc394e5b Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'result_collection_api/tests/unit/test_base.py')
-rw-r--r--result_collection_api/tests/unit/test_base.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/result_collection_api/tests/unit/test_base.py b/result_collection_api/tests/unit/test_base.py
new file mode 100644
index 0000000..b72436e
--- /dev/null
+++ b/result_collection_api/tests/unit/test_base.py
@@ -0,0 +1,36 @@
+from tornado.web import Application
+from tornado.testing import AsyncHTTPTestCase
+
+from resources.handlers import VersionHandler, PodHandler, \
+ TestProjectHandler, TestCasesHandler, TestResultsHandler, DashboardHandler
+import fake_pymongo
+
+
+class TestBase(AsyncHTTPTestCase):
+ def get_app(self):
+ return Application(
+ [
+ (r"/version", VersionHandler),
+ (r"/pods", PodHandler),
+ (r"/pods/([^/]+)", PodHandler),
+ (r"/test_projects", TestProjectHandler),
+ (r"/test_projects/([^/]+)", TestProjectHandler),
+ (r"/test_projects/([^/]+)/cases", TestCasesHandler),
+ (r"/test_projects/([^/]+)/cases/([^/]+)", TestCasesHandler),
+ (r"/results", TestResultsHandler),
+ (r"/results([^/]*)", TestResultsHandler),
+ (r"/results/([^/]*)", TestResultsHandler),
+ (r"/dashboard", DashboardHandler),
+ (r"/dashboard([^/]*)", DashboardHandler),
+ (r"/dashboard/([^/]*)", DashboardHandler),
+ ],
+ db=fake_pymongo,
+ debug=True,
+ )
+
+ def tearDown(self):
+ yield fake_pymongo.pod.remove()
+ yield fake_pymongo.test_projects.remove()
+ yield fake_pymongo.test_cases.remove()
+ yield fake_pymongo.test_results.remove()
+ super(TestBase, self).tearDown()