Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,13 @@ If you happen to know any extra or missing customer codes and API URL's, please
### Home Assistant

Home Assistant plugin using this library: [home_assistant_micronova_agua_iot](https://github.com/vincentwolsink/home_assistant_micronova_agua_iot)

## Integration tests

This project includes a cassette-based integration harness using `pytest` and `vcrpy`.

- Install dependencies: `python -m pip install -e ".[test]"`
- Replay tests only: `pytest tests/integration -m integration`
- Record or refresh cassettes (with `AGUA_*` env vars set): `VCR_RECORD_MODE=once pytest tests/integration -m integration`

Detailed recording instructions are in `tests/integration/README.md`.
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
markers =
integration: Tests that exercise the integration harness with recorded HTTP cassettes.
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@
"PyJWT>=2.1.0",
"requests>=2.25.1",
],
extras_require={
"test": [
"pytest>=8.0.0",
"vcrpy>=6.0.0",
],
},
)
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Test package for integration and unit modules."""
41 changes: 41 additions & 0 deletions tests/integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Integration test harness

This repository uses `pytest` + `vcrpy` for record/replay integration tests.

## Install test dependencies

```bash
python -m pip install -e ".[test]"
```

## Run replay-only integration tests

```bash
pytest tests/integration -m integration
```

By default, cassettes run in `VCR_RECORD_MODE=none` (no outbound HTTP allowed).

## Record cassettes with real credentials

Set the required environment variables:

- `AGUA_API_URL`
- `AGUA_CUSTOMER_CODE`
- `AGUA_EMAIL`
- `AGUA_PASSWORD`
- `AGUA_UNIQUE_ID`

Optional:

- `AGUA_LOGIN_API_URL`
- `AGUA_BRAND_ID` (default `1`)

Then record:

```bash
VCR_RECORD_MODE=once pytest tests/integration -m integration
```

After recording, inspect `tests/integration/cassettes/*.yaml` diffs and ensure no
sensitive values are present.
1 change: 1 addition & 0 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading