From a560009611eb3df2c41f05e9e35ca56fd1405d76 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Wed, 11 Feb 2026 10:25:19 +1100 Subject: [PATCH] TEST: fixing totals assert check dynamically Signed-off-by: jokob-sk --- test/api_endpoints/test_devices_endpoints.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/api_endpoints/test_devices_endpoints.py b/test/api_endpoints/test_devices_endpoints.py index ce498227..58a892a6 100644 --- a/test/api_endpoints/test_devices_endpoints.py +++ b/test/api_endpoints/test_devices_endpoints.py @@ -8,6 +8,7 @@ import pytest from helper import get_setting_value from api_server.api_server_start import app +from db.db_helper import get_device_conditions @pytest.fixture(scope="session") @@ -158,9 +159,13 @@ def test_devices_totals(client, api_token, test_mac): # 3. Ensure the response is a JSON list data = resp.json assert isinstance(data, list) - assert len(data) == 6 # devices, connected, favorites, new, down, archived - # 4. Check that at least 1 device exists + # 4. Dynamically get expected length + conditions = get_device_conditions() + expected_length = len(conditions) + assert len(data) == expected_length + + # 5. Check that at least 1 device exists assert data[0] >= 1 # 'devices' count includes the dummy device