Skip to content

Commit 6b0e158

Browse files
committed
test: coverage for q search of mcp
Signed-off-by: fege <fmosca@redhat.com>
1 parent 227c907 commit 6b0e158

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from typing import Self
2+
3+
import pytest
4+
from simple_logger.logger import get_logger
5+
6+
from tests.model_registry.mcp_servers.constants import CALCULATOR_SERVER_NAME
7+
from tests.model_registry.utils import execute_get_command
8+
9+
LOGGER = get_logger(name=__name__)
10+
11+
12+
@pytest.mark.usefixtures("mcp_servers_configmap_patch")
13+
class TestMCPServerKeywordSearch:
14+
"""Tests for MCP server keyword search via q parameter combined with other features."""
15+
16+
@pytest.mark.parametrize(
17+
"params, expected_names",
18+
[
19+
pytest.param(
20+
{"q": "Community", "filterQuery": "license='MIT'"},
21+
{"weather-api", CALCULATOR_SERVER_NAME},
22+
id="with_filter_query",
23+
),
24+
pytest.param(
25+
{"q": "Math", "namedQuery": "production_ready"},
26+
{CALCULATOR_SERVER_NAME},
27+
id="with_named_query",
28+
),
29+
],
30+
)
31+
def test_keyword_search_combined(
32+
self: Self,
33+
mcp_catalog_rest_urls: list[str],
34+
model_registry_rest_headers: dict[str, str],
35+
params: dict[str, str],
36+
expected_names: set[str],
37+
):
38+
"""TC-API-012: Test q parameter combined with filterQuery or namedQuery (AND logic)."""
39+
response = execute_get_command(
40+
url=f"{mcp_catalog_rest_urls[0]}mcp_servers",
41+
headers=model_registry_rest_headers,
42+
params=params,
43+
)
44+
items = response.get("items", [])
45+
actual_names = {server["name"] for server in items}
46+
assert actual_names == expected_names

0 commit comments

Comments
 (0)