Python aiohttp.test_utils.AioHTTPTestCase() Examples

The following are 2 code examples of aiohttp.test_utils.AioHTTPTestCase(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module aiohttp.test_utils , or try the search function .
Example #1
Source File: test_admin_server.py    From aries-cloudagent-python with Apache License 2.0 6 votes vote down vote up
def get_admin_server(self) -> AdminServer:
        if not self.admin_server:
            context = InjectionContext()
            context.settings["admin.admin_insecure_mode"] = True
            self.admin_server = AdminServer(
                "0.0.0.0",
                unused_port(),
                context,
                self.outbound_message_router,
                self.webhook_router,
            )
        return self.admin_server

    # the unittest_run_loop decorator can be used in tandem with
    # the AioHTTPTestCase to simplify running
    # tests that are asynchronous 
Example #2
Source File: test_secrets.py    From cjworkbench with GNU Affero General Public License v3.0 5 votes vote down vote up
def get_application(self):  # AioHTTPTestCase requirement
        app = web.Application()

        async def handle(request):
            self.last_request = request
            self.last_request_post = await request.post()
            return self.auth_response

        app.router.add_post("/refresh", handle)
        return app