curl-impersonate/tests
Alexandre Alapetite 172f5185cc
Update Docker base images (#168)
Update Docker base images to debian bookworm.
Reduce size of Debian image (remove apt cache) by 10MB
And also minor Markdown lint of INSTALL.md

---------

Co-authored-by: lwthiker <lwt@lwthiker.com>
2023-09-16 11:16:41 +03:00
..
signatures Add new Chrome (116) and Firefox (117) versions 2023-09-15 18:15:44 +03:00
ssl Test curl-impersonate's HTTP headers 2022-03-04 17:31:32 +02:00
conftest.py Use configurable binaries directory in the tests 2022-04-12 16:50:24 +03:00
Dockerfile Update Docker base images (#168) 2023-09-16 11:16:41 +03:00
minicurl.c Don't ignore useragent from CURLOPT_USERAGENT 2022-07-30 15:48:39 +03:00
pytest.ini tests: Use asyncio to wait for nghttpd to start 2022-04-30 13:58:11 +03:00
README.md Update README.md with Alpine-based Docker images 2022-03-10 13:34:56 +02:00
requirements.txt tests: Use asyncio to wait for nghttpd to start 2022-04-30 13:58:11 +03:00
signature.py Impersonate Chrome 110 (#148) 2023-02-25 11:29:14 +02:00
test_impersonate.py Add new Chrome (116) and Firefox (117) versions 2023-09-15 18:15:44 +03:00

The tests verify that curl-impersonate has the same network signature as that of the supported browsers. They do not test curl's functionality itself.

Running the tests

The tests assume that you've built both curl-impersonate-chrome and curl-impersonate-ff docker images before (see Building from source).

To run the tests, build with:

docker build -t curl-impersonate-tests tests/

then run with:

docker run --rm curl-impersonate-tests

This simply runs pytest in the container. You can pass additional flags to pytest such as --log-cli-level DEBUG.

How the tests work

For each supported browser, the following tests are performed:

  • A packet capture is started while curl-impersonate is run with the relevant wrapper script. The Client Hello message is extracted from the capture and compared against the known signature of the browser.
  • curl-impersonate is run, connecting to a local nghttpd server (a simple HTTP/2 server). The HTTP/2 pseudo-headers and headers are extracted from the output log of nghttpd and compared to the known headers of the browser.

What's missing

The following tests are still missing:

  • Test that curl-impersonate sends the same HTTP/2 SETTINGS as the browser.