Exemplo n.º 1
0
 async def test_002_destroy_server(self):
     with patch.object(self._api, '_handler') as i_handler:
         i_handler.shutdown.return_value = make_future([])
         with patch.object(self._api, '_server') as i_server:
             i_server.wait_closed.return_value = make_future([])
             with patch.object(self._api._server, 'close') as call_close:
                 await self._api.stop()
                 eq_(call_close.call_count, 1)
                 eq_(i_server.wait_closed.call_count, 1)
Exemplo n.º 2
0
 async def test_002_destroy_server(self):
     with patch.object(self._api, '_handler') as i_handler:
         i_handler.finish_connections.return_value = make_future([])
         with patch.object(self._api, '_server') as i_server:
             i_server.wait_closed.return_value = make_future([])
             with patch.object(self._api._server, 'close') as call_close:
                 await self._api.destroy()
                 eq_(call_close.call_count, 1)
                 eq_(i_server.wait_closed.call_count, 1)
Exemplo n.º 3
0
    async def test_001_request_valid_header_content_post_method(self):
        self._request.headers = {'CONTENT-TYPE': 'application/json'}
        ret_value = {'test_value': 'kikoo_test'}
        self._request.json.return_value = make_future(ret_value)
        self._request.method = 'POST'

        @future_func
        def _next_handler(r):
            return ret_value

        mdw = await mw_json(self._app, _next_handler)
        assert_is_not_none(mdw)
        response = await mdw(self._request)
        eq_(response, ret_value)