FAIL
FFFFFF [100%]
=================================== FAILURES ===================================
___________________________ test_basic_auth_required ___________________________
def test_basic_auth_required() -> None:
response = httpx.post(
BASE_URL,
json={"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}},
timeout=30,
verify=False,
)
> assert response.status_code in (401, 403)
E assert 404 in (401, 403)
E + where 404 = .status_code
tests/test_mcp_server.py:50: AssertionError
_______________________________ test_initialize ________________________________
def test_initialize() -> None:
> result = rpc("initialize")
^^^^^^^^^^^^^^^^^
tests/test_mcp_server.py:54:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_mcp_server.py:29: in rpc
response.raise_for_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
def raise_for_status(self) -> Response:
"""
Raise the `HTTPStatusError` if one occurred.
"""
request = self._request
if request is None:
raise RuntimeError(
"Cannot call `raise_for_status` as the request "
"instance has not been set on this response."
)
if self.is_success:
return self
if self.has_redirect_location:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"Redirect location: '{0.headers[location]}'\n"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
else:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
status_class = self.status_code // 100
error_types = {
1: "Informational response",
3: "Redirect response",
4: "Client error",
5: "Server error",
}
error_type = error_types.get(status_class, "Invalid status code")
message = message.format(self, error_type=error_type)
> raise HTTPStatusError(message, request=request, response=self)
E httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://mcpoperator.68.220.202.177.nip.io/mcp'
E For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
usr/local/lib/python3.11/site-packages/httpx/_models.py:829: HTTPStatusError
______________________ test_tools_list_contains_v1_tools _______________________
def test_tools_list_contains_v1_tools() -> None:
> result = rpc("tools/list")
^^^^^^^^^^^^^^^^^
tests/test_mcp_server.py:59:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_mcp_server.py:29: in rpc
response.raise_for_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
def raise_for_status(self) -> Response:
"""
Raise the `HTTPStatusError` if one occurred.
"""
request = self._request
if request is None:
raise RuntimeError(
"Cannot call `raise_for_status` as the request "
"instance has not been set on this response."
)
if self.is_success:
return self
if self.has_redirect_location:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"Redirect location: '{0.headers[location]}'\n"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
else:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
status_class = self.status_code // 100
error_types = {
1: "Informational response",
3: "Redirect response",
4: "Client error",
5: "Server error",
}
error_type = error_types.get(status_class, "Invalid status code")
message = message.format(self, error_type=error_type)
> raise HTTPStatusError(message, request=request, response=self)
E httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://mcpoperator.68.220.202.177.nip.io/mcp'
E For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
usr/local/lib/python3.11/site-packages/httpx/_models.py:829: HTTPStatusError
___________________ test_api_resources_includes_automationx ____________________
def test_api_resources_includes_automationx() -> None:
> result = call_tool("k8s_api_resources", {})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_mcp_server.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_mcp_server.py:34: in call_tool
return rpc("tools/call", {"name": name, "arguments": arguments}, request_id=request_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_mcp_server.py:29: in rpc
response.raise_for_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
def raise_for_status(self) -> Response:
"""
Raise the `HTTPStatusError` if one occurred.
"""
request = self._request
if request is None:
raise RuntimeError(
"Cannot call `raise_for_status` as the request "
"instance has not been set on this response."
)
if self.is_success:
return self
if self.has_redirect_location:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"Redirect location: '{0.headers[location]}'\n"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
else:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
status_class = self.status_code // 100
error_types = {
1: "Informational response",
3: "Redirect response",
4: "Client error",
5: "Server error",
}
error_type = error_types.get(status_class, "Invalid status code")
message = message.format(self, error_type=error_type)
> raise HTTPStatusError(message, request=request, response=self)
E httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://mcpoperator.68.220.202.177.nip.io/mcp'
E For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
usr/local/lib/python3.11/site-packages/httpx/_models.py:829: HTTPStatusError
___________________ test_can_list_pods_in_allowed_namespace ____________________
def test_can_list_pods_in_allowed_namespace() -> None:
> result = call_tool("k8s_list", {"resource": "pods", "namespace": NAMESPACE})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_mcp_server.py:75:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_mcp_server.py:34: in call_tool
return rpc("tools/call", {"name": name, "arguments": arguments}, request_id=request_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_mcp_server.py:29: in rpc
response.raise_for_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
def raise_for_status(self) -> Response:
"""
Raise the `HTTPStatusError` if one occurred.
"""
request = self._request
if request is None:
raise RuntimeError(
"Cannot call `raise_for_status` as the request "
"instance has not been set on this response."
)
if self.is_success:
return self
if self.has_redirect_location:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"Redirect location: '{0.headers[location]}'\n"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
else:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
status_class = self.status_code // 100
error_types = {
1: "Informational response",
3: "Redirect response",
4: "Client error",
5: "Server error",
}
error_type = error_types.get(status_class, "Invalid status code")
message = message.format(self, error_type=error_type)
> raise HTTPStatusError(message, request=request, response=self)
E httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://mcpoperator.68.220.202.177.nip.io/mcp'
E For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
usr/local/lib/python3.11/site-packages/httpx/_models.py:829: HTTPStatusError
______________________ test_rejects_disallowed_namespace _______________________
def test_rejects_disallowed_namespace() -> None:
> result = call_tool("k8s_list", {"resource": "pods", "namespace": "default"})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_mcp_server.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_mcp_server.py:34: in call_tool
return rpc("tools/call", {"name": name, "arguments": arguments}, request_id=request_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_mcp_server.py:29: in rpc
response.raise_for_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
def raise_for_status(self) -> Response:
"""
Raise the `HTTPStatusError` if one occurred.
"""
request = self._request
if request is None:
raise RuntimeError(
"Cannot call `raise_for_status` as the request "
"instance has not been set on this response."
)
if self.is_success:
return self
if self.has_redirect_location:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"Redirect location: '{0.headers[location]}'\n"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
else:
message = (
"{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
"For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}"
)
status_class = self.status_code // 100
error_types = {
1: "Informational response",
3: "Redirect response",
4: "Client error",
5: "Server error",
}
error_type = error_types.get(status_class, "Invalid status code")
message = message.format(self, error_type=error_type)
> raise HTTPStatusError(message, request=request, response=self)
E httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://mcpoperator.68.220.202.177.nip.io/mcp'
E For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
usr/local/lib/python3.11/site-packages/httpx/_models.py:829: HTTPStatusError
=============================== warnings summary ===============================
usr/local/lib/python3.11/site-packages/_pytest/cacheprovider.py:475
/usr/local/lib/python3.11/site-packages/_pytest/cacheprovider.py:475: PytestCacheWarning: could not create cache path /tests/.pytest_cache/v/cache/nodeids: [Errno 30] Read-only file system: '/tests/pytest-cache-files-go3amu8a'
config.cache.set("cache/nodeids", sorted(self.cached_nodeids))
usr/local/lib/python3.11/site-packages/_pytest/cacheprovider.py:429
/usr/local/lib/python3.11/site-packages/_pytest/cacheprovider.py:429: PytestCacheWarning: could not create cache path /tests/.pytest_cache/v/cache/lastfailed: [Errno 30] Read-only file system: '/tests/pytest-cache-files-z1_yln4i'
config.cache.set("cache/lastfailed", self.lastfailed)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_mcp_server.py::test_basic_auth_required - assert 404 in (40...
FAILED tests/test_mcp_server.py::test_initialize - httpx.HTTPStatusError: Cli...
FAILED tests/test_mcp_server.py::test_tools_list_contains_v1_tools - httpx.HT...
FAILED tests/test_mcp_server.py::test_api_resources_includes_automationx - ht...
FAILED tests/test_mcp_server.py::test_can_list_pods_in_allowed_namespace - ht...
FAILED tests/test_mcp_server.py::test_rejects_disallowed_namespace - httpx.HT...
6 failed, 2 warnings in 0.51s