Skip to content

Commit

Permalink
Flesh out unit test for google
Browse files Browse the repository at this point in the history
  • Loading branch information
piercefreeman committed Dec 24, 2022
1 parent ab4d184 commit f12ac86
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def install_ca():
run(
run([
str(get_asset_path("grooveproxy")),
"install-ca",
)
])
3 changes: 2 additions & 1 deletion groove/groove-python/groove/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def proxy():
def browser():
with sync_playwright() as p:
yield p.chromium.launch(
headless=True,
#headless=True,
headless=False,
)

@pytest.fixture
Expand Down
20 changes: 17 additions & 3 deletions groove/groove-python/groove/tests/test_fingerprint.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
import pytest
from playwright._impl._api_types import Error as PlaywrightError

from groove.proxy import ProxyFailureError
from groove.proxy import ProxyFailureError, Groove


@pytest.mark.xfail(reason="TLS certificate blocked", raises=ProxyFailureError)
def test_tls_addons(proxy, context):
def test_tls_addons(proxy: Groove, context):
"""
Test TLS addons
"""
page = context.new_page()

proxy.tape_start()

try:
page.goto("https://www.google.com:443/")
except PlaywrightError as e:
if "net::ERR_EMPTY_RESPONSE" in e.message:
raise ProxyFailureError()

# Get the page
tape_session = proxy.tape_get()

assert len(tape_session.records) > 1

main_page = [
record
for record in tape_session.records
if record.request.url.strip("/") == "https://www.google.com:443"
]

assert len(main_page[0].response.body) > 0

0 comments on commit f12ac86

Please sign in to comment.