| 1 |
# Home Assistant Integration Tests |
| 2 |
|
| 3 |
This directory contains integration tests for the Home Assistant notification service in Shoutrrr. |
| 4 |
The tests mock HTTP requests to the Home Assistant REST API and do not make outbound network calls. |
| 5 |
|
| 6 |
## Test Coverage |
| 7 |
|
| 8 |
### Configuration |
| 9 |
|
| 10 |
- URL parsing for `homeassistant://TOKEN@host` |
| 11 |
- Query parameters (`title`, `nid`, `disabletls`, `service`, `targets`) |
| 12 |
- Rejection of missing token or host |
| 13 |
|
| 14 |
### Message Sending |
| 15 |
|
| 16 |
- Basic persistent notification |
| 17 |
- Title and notification ID |
| 18 |
- Title via params map |
| 19 |
- Notify-platform actions without `notification_id` |
| 20 |
- Rejection of empty messages |
| 21 |
|
| 22 |
### Error Handling |
| 23 |
|
| 24 |
- HTTP error responses (400, 401, 404, 500) |
| 25 |
- Network errors |
| 26 |
|
| 27 |
### API Compliance |
| 28 |
|
| 29 |
- Endpoint `POST /api/services/persistent_notification/create` |
| 30 |
- JSON content type |
| 31 |
- `Authorization: Bearer` header |
| 32 |
- User-Agent `shoutrrr/<version>` |
| 33 |
- Implied HTTP port 8123 when TLS is disabled |
| 34 |
- Reverse-proxy path prefix |
| 35 |
|
| 36 |
## Running the Tests |
| 37 |
|
| 38 |
```bash |
| 39 |
go test ./testing/integration/homeassistant/ -v |
| 40 |
``` |