summaryrefslogtreecommitdiff
path: root/crocoite/test_devtools.py
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2018-11-14 18:40:28 +0100
committerLars-Dominik Braun <lars@6xq.net>2018-11-14 18:40:28 +0100
commit20634f87124e0529f45db4e5e801f1bb5c6de32c (patch)
tree27f5307865f3a5188a71a7d14f1790bb021034a2 /crocoite/test_devtools.py
parentf273341d6486f139eed073e4664b985209567e96 (diff)
downloadcrocoite-20634f87124e0529f45db4e5e801f1bb5c6de32c.tar.gz
crocoite-20634f87124e0529f45db4e5e801f1bb5c6de32c.tar.bz2
crocoite-20634f87124e0529f45db4e5e801f1bb5c6de32c.zip
Async chrome process startup
Move it to .devtools. Seems more fitting.
Diffstat (limited to 'crocoite/test_devtools.py')
-rw-r--r--crocoite/test_devtools.py19
1 files changed, 14 insertions, 5 deletions
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
+