A pytest plugin that provides a running Argus API server for tests.
This pytest plugin was generated with Cookiecutter along with @hackebrot's cookiecutter-pytest-plugin template.
- Fixtures that will provide tests with a running Argus API server (using Docker Compose)
You can install "pytest-argus-server" via pip from PyPI:
$ pip install pytest-argus-server
Installing this package will automatically make it available in pytest.
By default, this plugin will run the latest available Argus server Docker
image. The actually deployed version can be controlled by adding the
--argus-version command line option to pytest:
pytest --argus-version=1.30.0 tests/
The main fixtures provided by this plugin are the session-scoped
argus_api_url and argus_source_system_token.
When used by a test, this will ensure an Argus server is running and ready to take requests. It returns the base URL of the running API:
def test_url_should_be_as_expected(argus_api_url):
assert argus_api_url == "http://localhost:8000/api/v2/"This token will create a test source system and return a valid API token for accessing the API as this test source.
def test_fetch_incidents(argus_api_url, argus_source_system_token):
assert requests.get(
f"{argus_api_url}/incidents/",
headers={"Authorization": f"Token {argus_source_system_token}"}
).status_code == 200- The port number of the launched API server is hard-coded to 8000.
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
Distributed under the terms of the Apache Software License 2.0 license, "pytest-argus-server" is free and open source software
If you encounter any problems, please file an issue along with a detailed description.