Exemple #1
0
    def test_raw_websocket(self, ws):
        ws.return_value.process.return_value = asyncio.Future(loop=self.loop)
        ws.return_value.process.return_value.set_result(web.HTTPOk())

        route = self.make_route()
        request = self.make_request(
            'GET', '/sm/', headers=CIMultiDict({}))
        res = self.loop.run_until_complete(route.websocket(request))

        self.assertIsInstance(res, web.HTTPOk)
        self.assertTrue(ws.called)
        self.assertTrue(ws.return_value.process.called)
Exemple #2
0
 def test_raw_websocket_fail(self):
     route = self.make_route()
     request = self.make_request('GET', '/sm/')
     res = self.loop.run_until_complete(route.websocket(request))
     self.assertIsInstance(res, web.HTTPNotFound)