示例#1
0
class HTTPTestCase(PantsTestCase):
    def request_handler(self, request):
        raise NotImplementedError

    def setUp(self):
        engine = Engine.instance()
        self.server = HTTPServer(self.request_handler, engine=engine)
        self.server.listen(('127.0.0.1', 4040))
        PantsTestCase.setUp(self, engine)

    def tearDown(self):
        PantsTestCase.tearDown(self)
        self.server.close()
示例#2
0
class WSGITestCase(PantsTestCase):
    def application(self, env, start_response):
        raise NotImplementedError

    def setUp(self):
        engine = Engine.instance()
        self.server = HTTPServer(WSGIConnector(self.application, debug=True), engine=engine)
        self.server.listen(('127.0.0.1', 4040))
        PantsTestCase.setUp(self, engine)

    def tearDown(self):
        PantsTestCase.tearDown(self)
        self.server.close()
示例#3
0
class HTTPTestCase(PantsTestCase):
    def request_handler(self, request):
        raise NotImplementedError

    def setUp(self):
        engine = Engine.instance()
        self.server = HTTPServer(self.request_handler, engine=engine)
        self.server.listen(("127.0.0.1", 4040))
        PantsTestCase.setUp(self, engine)

    def tearDown(self):
        PantsTestCase.tearDown(self)
        self.server.close()
示例#4
0
class WSGITestCase(PantsTestCase):
    def application(self, env, start_response):
        raise NotImplementedError

    def setUp(self):
        engine = Engine.instance()
        self.server = HTTPServer(WSGIConnector(self.application, debug=True),
                                 engine=engine)
        self.server.listen(('127.0.0.1', 4040))
        PantsTestCase.setUp(self, engine)

    def tearDown(self):
        PantsTestCase.tearDown(self)
        self.server.close()
示例#5
0
class AppTestCase(PantsTestCase):
    def init_app(self, app):
        raise NotImplementedError

    def setUp(self):
        self.app = Application()
        self.init_app(self.app)

        engine = Engine.instance()
        self.server = HTTPServer(self.app, engine=engine)
        self.server.listen(('127.0.0.1', 4040))
        PantsTestCase.setUp(self, engine)

    def tearDown(self):
        PantsTestCase.tearDown(self)
        self.server.close()