コード例 #1
0
ファイル: base.py プロジェクト: AnthonyNystrom/py-hbpush
class TornadoTestCase(TestCase):
    failureException = StrongAssertionError

    def setUp(self):
        self.io_loop = MockIOLoop()

    def tearDown(self):
        self.finish()

    def start(self):
        self.io_loop.start()

    def finish(self, *args):
        self.io_loop.stop()

    def execute(self, *args):
        seq(*args)(self.finish)
        self.start()

        # We start an ioloop only if the chain has not
        # been executed asynchronously

        
    def expect(self, status=None, headers=(), body=None):
        def _expect(st, hdrs, bdy):
            if status:
                self.assertEquals(status, st)
            for (name, value) in (h.split(': ') for h in headers):
                self.assertTrue(name in hdrs)
                self.assertEquals(value, hdrs[name])
            if body:
                self.assertEquals(body, bdy)
        return _expect
コード例 #2
0
ファイル: base.py プロジェクト: AnthonyNystrom/py-hbpush
 def setUp(self):
     self.io_loop = MockIOLoop()