From 20634f87124e0529f45db4e5e801f1bb5c6de32c Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Wed, 14 Nov 2018 18:40:28 +0100 Subject: Async chrome process startup Move it to .devtools. Seems more fitting. --- crocoite/test_devtools.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'crocoite/test_devtools.py') diff --git a/crocoite/test_devtools.py b/crocoite/test_devtools.py index 4ffbbf8..8676e6c 100644 --- a/crocoite/test_devtools.py +++ b/crocoite/test_devtools.py @@ -24,12 +24,11 @@ import pytest from aiohttp import web import websockets -from .browser import ChromeService, NullService -from .devtools import Browser, Tab, MethodNotFound, Crashed, InvalidParameter +from .devtools import Browser, Tab, MethodNotFound, Crashed, InvalidParameter, Process, Passthrough @pytest.fixture async def browser (): - with ChromeService () as url: + async with Process () as url: yield Browser (url) @pytest.fixture @@ -138,7 +137,8 @@ async def test_recv_failure(browser): with pytest.raises (Crashed): await handle -def test_tab_function (tab): +@pytest.mark.asyncio +async def test_tab_function (tab): assert tab.Network.enable.name == 'Network.enable' assert tab.Network.disable == tab.Network.disable assert tab.Network.enable != tab.Network.disable @@ -147,7 +147,8 @@ def test_tab_function (tab): assert not callable (tab.Network.enable.name) assert 'Network.enable' in repr (tab.Network.enable) -def test_tab_function_hash (tab): +@pytest.mark.asyncio +async def test_tab_function_hash (tab): d = {tab.Network.enable: 1, tab.Network.disable: 2, tab.Page: 3, tab.Page.enable: 4} assert len (d) == 4 @@ -161,3 +162,11 @@ async def test_ws_ping(tab): await tab.ws.ping () await tab.Browser.getVersion () +@pytest.mark.asyncio +async def test_passthrough (): + """ Null service returns the url as is """ + + url = 'http://localhost:12345' + async with Passthrough (url) as u: + assert u == url + -- cgit v1.2.3