Add test suite for core components #1

Closed
opened 2026-02-18 11:01:33 +13:00 by guisea · 0 comments
Owner

Implemented in commit bd46227.

73 tests, all green, ~0.5s runtime.

Coverage:

  • tests/conftest.py — shared in-memory SQLite fixture + connect() monkeypatch
  • tests/test_utils.py — all 5 zone index helper functions (13 tests)
  • tests/test_admin_api.pyCMD_API_LOGIN_TEST, _handle_exists (0/1/2), rawsave, delete (12 tests)
  • tests/test_reconciler.py — orphan detection, dry-run, backfill, migration, _fetch_da_domains (HTTP/SSL/timeout/HTML/pagination), _parse_da_domain_list, lifecycle (21 tests)
  • tests/test_zone_parser.pyvalidate_and_normalize_zone, count_zone_records (12 tests)
  • tests/test_coredns_mysql.py — rewritten; write/update/delete/reconcile/verify (15 tests)

Also fixed two bugs found while writing tests:

  • zone_exists filtering on wrong column (namezone_name)
  • delete_zone missing dot_fqdn() normalization

Also removed legacy artifacts: app.py (v1 Flask prototype), config.json (empty), config/app.yml (root-level duplicate).

Implemented in commit `bd46227`. **73 tests, all green, ~0.5s runtime.** Coverage: - `tests/conftest.py` — shared in-memory SQLite fixture + `connect()` monkeypatch - `tests/test_utils.py` — all 5 zone index helper functions (13 tests) - `tests/test_admin_api.py` — `CMD_API_LOGIN_TEST`, `_handle_exists` (0/1/2), rawsave, delete (12 tests) - `tests/test_reconciler.py` — orphan detection, dry-run, backfill, migration, `_fetch_da_domains` (HTTP/SSL/timeout/HTML/pagination), `_parse_da_domain_list`, lifecycle (21 tests) - `tests/test_zone_parser.py` — `validate_and_normalize_zone`, `count_zone_records` (12 tests) - `tests/test_coredns_mysql.py` — rewritten; write/update/delete/reconcile/verify (15 tests) Also fixed two bugs found while writing tests: - `zone_exists` filtering on wrong column (`name` → `zone_name`) - `delete_zone` missing `dot_fqdn()` normalization Also removed legacy artifacts: `app.py` (v1 Flask prototype), `config.json` (empty), `config/app.yml` (root-level duplicate).
guisea added the enhancement label 2026-02-18 11:01:33 +13:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cybercinch/directdnsonly#1