summaryrefslogtreecommitdiffstats
path: root/utils/test/result_collection_api/tests/unit/test_base.py
blob: b72436eb0fe226a9d4bb277d267914b7a953585f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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()