Skip to content

Commit 1fa03f7

Browse files
committed
Enhance test coverage and documentation for UniFi client handling and API response validation
1 parent 8c41b4e commit 1fa03f7

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

.github/workflows/quality.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,24 @@ jobs:
3838
- name: Check test file count
3939
run: |
4040
echo "Total test files: $(find tests/ -name 'test_*.py' | wc -l)"
41-
echo "Total tests: $(python -m pytest tests/ --collect-only -q | grep '::' | wc -l)"
41+
echo "Total tests: $(python -m pytest tests/ --collect-only -q | awk '{s+=$2} END {print s}')"
4242
4343
- name: Validate test requirements coverage
4444
run: |
4545
echo "✅ Validating test coverage for requirements:"
46-
echo "1. No exceptions when selecting only one feature during configuration"
47-
python -m pytest tests/test_simple_validation.py::TestBasicValidation::test_config_flow_feature_validation -v
48-
python -m pytest tests/test_simple_validation.py::TestBasicValidation::test_single_feature_configurations -v
49-
50-
echo "2. No exception if API calls fail"
46+
echo "1. No exception if API calls fail"
5147
python -m pytest tests/test_api_helpers.py::TestFetchAllPages::test_http_error_response -v
48+
python -m pytest tests/test_api_helpers.py::TestFetchAllPages::test_none_response -v
5249
python -m pytest tests/test_coordinator.py::TestUnifiDeviceCoordinator::test_fetch_devices_api_failure -v
50+
python -m pytest tests/test_coordinator.py::TestUnifiClientCoordinator::test_fetch_clients_api_failure -v
5351
54-
echo "3. No exception if missing information in API responses"
52+
echo "2. No exception if missing information in API responses"
5553
python -m pytest tests/test_unifi_device.py::TestUnifiDevice::test_device_with_unset_values -v
54+
python -m pytest tests/test_unifi_device.py::TestUnifiDevice::test_device_with_missing_attributes -v
5655
python -m pytest tests/test_api_helpers.py::TestFetchAllPages::test_missing_data_attribute -v
56+
python -m pytest tests/test_coordinator.py::TestUnifiDeviceCoordinator::test_fetch_devices_with_statistics_failure -v
57+
58+
echo "3. UniFi client handling and data processing"
59+
python -m pytest tests/test_unifi_client.py::TestUnifiClient::test_client_id_property -v
60+
python -m pytest tests/test_unifi_client.py::TestUnifiClient::test_mac_priority_overview_over_details -v
61+
python -m pytest tests/test_unifi_client.py::TestUnifiClient::test_device_info_with_complete_data -v

tests/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Tests handling of:
4141

4242
- **`test_api_helpers.py`** - Tests for API helper functions (pagination, error handling)
4343
- **`test_unifi_device.py`** - Tests for UnifiDevice wrapper (handling missing data)
44+
- **`test_unifi_client.py`** - Tests for UnifiClient wrapper (client properties, MAC handling, DeviceInfo)
4445
- **`test_coordinator.py`** - Tests for data coordinators (API failure scenarios)
4546

4647
### Support Files

0 commit comments

Comments
 (0)