Skip to content

[Sub] Write Entity Platform Tests #17

Description

@switch180

Parent Issue: #4 Zero Test Coverage

Objective

Create unit tests for all entity platforms (sensors, binary sensors, selects) covering state derivation and user actions.

Test Coverage Areas

Sensor Platform Tests

  • test_receiver_temperature_sensor - Temperature state
  • test_video_source_sensor - Source name and attributes
  • test_audio_source_sensor - Audio source info
  • test_video_signal_sensor - Signal formatting
  • test_transmitter_stream_sensors - Stream state
  • test_ip_address_sensor - Network info
  • test_firmware_sensor - Version display

Binary Sensor Platform Tests

  • test_online_sensor - Connectivity state
  • test_video_streaming_sensor - Stream state detection
  • test_audio_streaming_sensor - Audio state

Select Platform Tests

  • test_video_source_select_options - Source list generation
  • test_video_source_select_current - Current value
  • test_video_source_select_action - Join/leave calls
  • test_display_mode_select - Mode changes
  • test_resolution_preset_select - Resolution selection
  • test_pending_resolution_handling - Genlock mode behavior

Entity Base Tests

  • test_device_info_generation - Device info structure
  • test_entity_availability - Availability logic
  • test_entity_attributes - Extra state attributes

Mock Strategy

# Mock coordinator with fixture data
@pytest.fixture
def mock_coordinator():
    coordinator = Mock(spec=RiverLinkDataUpdateCoordinator)
    coordinator.data = {
        "receivers": {...},
        "transmitters": {...}
    }
    return coordinator

Target Coverage

  • Goal: 80%+ line coverage per platform file
  • Focus: State derivation and user actions

References

Priority

🟡 Medium - User-facing components

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