Skip to content

[Sub] Write Integration Tests #18

Description

@switch180

Parent Issue: #4 Zero Test Coverage

Objective

Create end-to-end integration tests covering the full setup flow, coordinator updates, and user actions with mocked API.

Test Coverage Areas

Setup Flow Tests

  • test_setup_entry_success - Successful integration setup
  • test_setup_entry_failure - Connection failure handling
  • test_config_flow_user_step - UI configuration
  • test_config_flow_validation - Connection validation
  • test_platform_loading - All platforms load correctly

Coordinator Integration Tests

  • test_coordinator_first_refresh - Initial data fetch
  • test_coordinator_update_cycle - Polling updates
  • test_coordinator_update_failure - Error recovery
  • test_entity_creation - Entities created from data

User Action Integration Tests

  • test_video_routing_flow - Complete routing scenario
  • test_display_mode_change_flow - Mode change + refresh
  • test_resolution_change_flow - Resolution update
  • test_disconnect_flow - Leave subscription flow

State Propagation Tests

  • test_api_to_coordinator_to_entity - Full data flow
  • test_entity_state_update - State updates on refresh
  • test_multiple_entities_update - All entities sync

Error Scenario Tests

  • test_network_failure_recovery - Transient errors
  • test_device_disconnect_handling - Device offline
  • test_api_error_propagation - Error handling

Test Strategy

# Use Home Assistant test utilities
from pytest_homeassistant_custom_component.common import MockConfigEntry

async def test_setup_entry_success(hass):
    entry = MockConfigEntry(
        domain=DOMAIN,
        data={"host": "10.0.1.135", "port": 6970}
    )
    # Mock API responses
    # Test full setup

Target Coverage

  • Goal: 75%+ coverage for integration scenarios
  • Focus: Critical user flows and error paths

References

Priority

🟡 Medium - Integration validation

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