def METHOD_NAME(mocker, name, version, expected_exception, expected_message):
    mock_method = mocker.patch('ovmsclient.tfs_compat.grpc.requests._check_model_spec',
                               side_effect=expected_exception(expected_message))
    with pytest.raises(expected_exception) as e_info:
        make_metadata_request(name, version)
    assert str(e_info.value) == expected_message
    mock_method.assert_called_once()