fix: add missing __init__.py to tests/api subpackages to fix relative imports

This commit is contained in:
2026-04-09 12:24:09 -04:00
parent a22f996027
commit ec66e01f55
13 changed files with 355 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
from fastapi.testclient import TestClient
from decnet.web.api import app
from decnet.env import DECNET_ADMIN_USER, DECNET_ADMIN_PASSWORD
def test_get_deckies_endpoint(mock_state_file):
with TestClient(app) as _client:
# Login to get token
_login_resp = _client.post("/api/v1/auth/login", json={"username": DECNET_ADMIN_USER, "password": DECNET_ADMIN_PASSWORD})
_token = _login_resp.json()["access_token"]
_response = _client.get("/api/v1/deckies", headers={"Authorization": f"Bearer {_token}"})
assert _response.status_code == 200
_data = _response.json()
assert len(_data) == 2
assert _data[0]["name"] == "test-decky-1"
assert _data[0]["service_config"]["ssh"]["banner"] == "SSH-2.0-OpenSSH_8.9"