A plugin that provides a running Argus API server for tests
Project description
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.
Features
Fixtures that will provide tests with a running Argus API server (using Docker Compose)
Requirements
Installation
You can install “pytest-argus-server” via pip from PyPI:
$ pip install pytest-argus-server
Usage
Installing this package will automatically make it available in pytest.
Extra pytest command line arguments
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/
Provided fixtures
The main fixtures provided by this plugin are the session-scoped argus_api_url and argus_source_system_token.
argus_api_url
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/"
argus_source_system_token
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
Bugs
The port number of the launched API server is hard-coded to 8000.
Contributing
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.
License
Distributed under the terms of the Apache Software License 2.0 license, “pytest-argus-server” is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_argus_server-0.2.0.tar.gz.
File metadata
- Download URL: pytest_argus_server-0.2.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a032fef46c3ae7484ce287228823a11f4d6365ddba12aed50d3c94447128d24
|
|
| MD5 |
d94e72a20484b4a190b69d49cf2454c8
|
|
| BLAKE2b-256 |
15a0136052de423989894d120179ee4dfee1180276269a5c8a07fab575bbd423
|
File details
Details for the file pytest_argus_server-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pytest_argus_server-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e16ef398b19f8a6eb29c94f50e951be204785e57d39a3b02f1fe26e56c703f3
|
|
| MD5 |
20fe06a6ace86e2f5201ed923b8dce68
|
|
| BLAKE2b-256 |
fc02df5e8759b034d837f0882d51fbf518b9f19305fcb8d9817ac99190e57453
|