[PATCH] First HTTP functional test of the RPC interface

Lukas Fleischer lfleischer at archlinux.org
Tue Apr 14 12:54:03 UTC 2020


Hi Frédéric,

Thanks for the work! My first thoughts below.

On Sun, 12 Apr 2020 at 12:55:46, Frédéric Mangano-Tarumi wrote:
> Though barely useful in its current state, it shows how to integrate
> pytest with SQLAlchemy and Werkzeug, providing a test framework for the
> potential future Flask port, while actually testing the current PHP
> implementation.
> ---
>  aurweb/test/__init__.py |  0
>  aurweb/test/conftest.py | 51 +++++++++++++++++++++++++++++++++++++++++
>  aurweb/test/test_rpc.py | 21 +++++++++++++++++
>  aurweb/test/wsgihttp.py | 38 ++++++++++++++++++++++++++++++
>  test/README.md          |  3 +++
>  test/rpc.t              |  2 ++
>  6 files changed, 115 insertions(+)
>  create mode 100644 aurweb/test/__init__.py
>  create mode 100644 aurweb/test/conftest.py
>  create mode 100644 aurweb/test/test_rpc.py
>  create mode 100644 aurweb/test/wsgihttp.py
>  create mode 100755 test/rpc.t
> [...]
> + at pytest.fixture
> +def client():
> +    """
> +    Build a Werkzeug test client for making HTTP requests to AUR. It requires
> +    that the AUR test website is already running at `[options] aur_location`,
> +    specified in the configuration file.
> +
> +    When aurweb becomes a pure Flask application, this should return Flask\u2019s
> +    test_client(), which is a Werkzeug test client too.
> +    https://flask.palletsprojects.com/en/1.1.x/testing/#the-testing-skeleton
> +    """
> +    base_uri = aurweb.config.get("options", "aur_location")
> +    proxy = WsgiHttpProxy(base_uri)
> +    return werkzeug.test.Client(proxy, Response)

If I understand correctly, this runs tests against our production setup
at aur.archlinux.org. Is that what you ultimately plan to do in the
transition phase?

On a related note, the current test suite has been designed to run in an
isolated environment without any prior configuration or network
connectivity. Do we want to break either of these assumptions? Breaking
the latter might be okay, but I would like to keep the test suite
self-contained. If that turns out to be too hard, I'd be fine with
splitting the tests into two parts (a self-contained part and another
part that requires a local aurweb setup). We also need to think about
how to integrate all that with CI.

Lukas


More information about the aur-dev mailing list