Skip to content

[Sub] Write Coordinator Unit Tests #16

Description

@switch180

Parent Issue: #4 Zero Test Coverage

Objective

Create comprehensive unit tests for the RiverLinkDataUpdateCoordinator covering data parsing, mode detection, and stream mapping.

Test Coverage Areas

Data Parsing Tests

  • test_parse_device_data - Overall parsing logic
  • test_parse_receiver - Receiver data extraction
  • test_parse_transmitter - Transmitter data extraction
  • test_stream_map_building - Multicast address mapping

Video Mode Detection Tests

  • test_extract_video_mode_genlock - Genlock mode detection
  • test_extract_video_mode_genlock_scaling - Scaling mode
  • test_extract_video_mode_fastswitch - Fast switch modes
  • test_extract_video_mode_wall - Video wall modes
  • test_extract_video_mode_multiview - Multiview detection

Resolution Tests

  • test_find_resolution_preset - Preset matching
  • test_custom_resolution - Non-standard resolutions
  • test_pending_resolution_persistence - Pending state handling

Signal Extraction Tests

  • test_extract_video_signal - Video signal info
  • test_extract_hdcp_info - HDCP status
  • test_extract_ip_address - Network info

Error Scenarios

  • test_missing_devices - Empty device list
  • test_malformed_response - Invalid API data
  • test_missing_nodes - Incomplete device info

Mock Strategy

# Use fixture files for API responses
@pytest.fixture
def mock_api_response():
    with open('tests/fixtures/api_responses.json') as f:
        return json.load(f)

Target Coverage

  • Goal: 85%+ line coverage for coordinator.py
  • Focus: Parsing logic and edge cases

References

Priority

🔴 High - Critical parsing logic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions