示例#1
0
def rest_api(loop, aiohttp_client, mock_dlmgr, metadata_store):  # pylint: disable=unused-argument

    endpoint = DownloadsEndpoint(mock_dlmgr, metadata_store=metadata_store)

    app = Application(middlewares=[error_middleware])
    app.add_subapp('/downloads', endpoint.app)
    return loop.run_until_complete(aiohttp_client(app))
示例#2
0
def rest_api(loop, aiohttp_client, mock_dlmgr, metadata_store, tags_db):  # pylint: disable=unused-argument
    mock_gigachannel_manager = Mock()
    mock_gigachannel_community = Mock()

    def return_exc(*args, **kwargs):
        raise RequestTimeoutException

    mock_dlmgr.metainfo_requests = {}

    mock_gigachannel_community.remote_select_channel_contents = return_exc
    ep_args = [
        mock_dlmgr, mock_gigachannel_manager, mock_gigachannel_community,
        metadata_store
    ]
    ep_kwargs = {'tags_db': tags_db}
    collections_endpoint = ChannelsEndpoint(*ep_args, **ep_kwargs)
    channels_endpoint = ChannelsEndpoint(*ep_args, **ep_kwargs)

    app = Application(middlewares=[error_middleware])
    app.add_subapp('/channels', channels_endpoint.app)
    app.add_subapp('/collections', collections_endpoint.app)
    return loop.run_until_complete(aiohttp_client(app))
示例#3
0
def rest_api(loop, aiohttp_client, endpoint):  # pylint: disable=unused-argument
    app = Application(middlewares=[error_middleware])
    app.add_subapp('/statistics', endpoint.app)
    return loop.run_until_complete(aiohttp_client(app))
示例#4
0
def rest_api(loop, aiohttp_client, mock_tunnel_community, endpoint):  # pylint: disable=unused-argument
    endpoint.tunnel_community = mock_tunnel_community

    app = Application(middlewares=[error_middleware])
    app.add_subapp('/debug', endpoint.app)
    return loop.run_until_complete(aiohttp_client(app))
示例#5
0
def rest_api(loop, needle_in_haystack_mds, aiohttp_client, tags_db):
    channels_endpoint = SearchEndpoint(needle_in_haystack_mds, tags_db=tags_db)
    app = Application()
    app.add_subapp('/search', channels_endpoint.app)
    return loop.run_until_complete(aiohttp_client(app))
示例#6
0
def rest_api(loop, aiohttp_client, torrent_checker, metadata_store):  # pylint: disable=unused-argument
    endpoint = MetadataEndpoint(torrent_checker, metadata_store)

    app = Application(middlewares=[error_middleware])
    app.add_subapp('/metadata', endpoint.app)
    return loop.run_until_complete(aiohttp_client(app))
示例#7
0
def rest_api(loop, aiohttp_client, tags_endpoint):
    app = Application()
    app.add_subapp('/tags', tags_endpoint.app)
    return loop.run_until_complete(aiohttp_client(app))