Ejemplo n.º 1
0
def mock_get_schedules_response(
    schedule_object, ) -> Generator[MagicMock, Any, None]:
    """Fixture for mocking the get_schedules response.

    Args:
      schedule_object: Fixture of mocked ``SwitcherV2Schedule`` object.

    Yields:
      Mocked ``SwitcherV2GetScheduleResponseMSG`` object.

    """
    mock_response = MagicMock(messages.SwitcherV2GetScheduleResponseMSG)
    mock_response.successful = True
    mock_response.found_schedules = True
    mock_response.get_schedules = [schedule_object]
    mock_response.msg_type = messages.ResponseMessageType.GET_SCHEDULES

    with patch(
            "request_handlers.messages.SwitcherV2GetScheduleResponseMSG",
            new=mock_response,
    ) as patcher:
        yield patcher