def test_select_reservations_ok(service: UpdateReservationCache,
                                context: Context, house, reservation):
    service._reservations_repo = Mock(select=Mock(return_value=[reservation]))
    context.house = house

    result = service.select_reservations(context)
    assert is_successful(result)
    assert result.unwrap().reservations == [reservation]
def test_select_reservations_error(service: UpdateReservationCache,
                                   context: Context, house):
    service._reservations_repo = Mock(select=Mock(
        side_effect=RuntimeError('ERR')))
    context.house = house

    result = service.select_reservations(context)
    assert not is_successful(result)
    assert result.failure().failure == ReservationErrors.error
    assert str(result.failure().exc) == 'ERR'