Files
intervalsicu-mcp/tests/test_validation.py
T
Chris Farhood 935abf86d4
build-image / build (push) Failing after 18s
Fork intervals-mcp-server: native OAuth + streamable-HTTP, no monkeypatch
- Bump mcp[cli] 1.22 -> 1.28.1 (negotiates MCP protocol 2025-11-25, matching
  current Claude clients; the old 2025-06-18 server never got a tools/list on
  the connector surface).
- Bake transport config into code: stateless_http + json_response for HTTP
  (single JSON body instead of a 34KB SSE stream, which the connector pipeline
  handles far more reliably).
- Bake Authentik OAuth (AuthSettings + JWT TokenVerifier) into intervals_mcp_server.auth,
  configured from MCP_ISSUER/MCP_RESOURCE/MCP_JWKS_URI/MCP_CLIENT_ID — removes the
  runtime FastMCP.__init__ monkeypatch from the k8s deployment command.
- Accept token audience with/without trailing slash (RFC 8707 clients use the
  slash-normalised resource metadata value).
- Dockerfile CMD runs the module (transport via MCP_TRANSPORT); add .gitea CI to
  build+push the image to git.farh.net/farhoodlabs/intervalsicu-mcp.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-04 15:07:46 -04:00

55 lines
1.7 KiB
Python

"""
Unit tests for resolve_activity_type in intervals_mcp_server.utils.validation.
"""
from intervals_mcp_server.utils.validation import resolve_activity_type
def test_explicit_activity_type_returned_as_is():
"""Explicit activity_type is returned unchanged."""
assert resolve_activity_type(None, "VirtualRide") == "VirtualRide"
assert resolve_activity_type("morning swim", "Run") == "Run"
def test_keyword_ride():
"""Cycling keywords resolve to Ride."""
for name in ["Morning Ride", "cycling session", "bike workout", "cycle"]:
assert resolve_activity_type(name) == "Ride"
def test_keyword_run():
"""Running keywords resolve to Run."""
for name in ["Easy Run", "jogging", "morning jog", "running"]:
assert resolve_activity_type(name) == "Run"
def test_keyword_swim():
"""Swimming keywords resolve to Swim."""
for name in ["Pool Swim", "swimming drills", "swim"]:
assert resolve_activity_type(name) == "Swim"
def test_keyword_walk():
"""Walking keywords resolve to Walk."""
for name in ["Evening Walk", "hiking trip", "hike", "walking"]:
assert resolve_activity_type(name) == "Walk"
def test_keyword_row():
"""Rowing keywords resolve to Row."""
for name in ["Rowing session", "morning row"]:
assert resolve_activity_type(name) == "Row"
def test_default_ride_when_no_match():
"""Defaults to Ride when no keyword matches."""
assert resolve_activity_type("stretching") == "Ride"
assert resolve_activity_type(None) == "Ride"
assert resolve_activity_type("") == "Ride"
def test_case_insensitive():
"""Keyword matching is case-insensitive."""
assert resolve_activity_type("MORNING RUN") == "Run"
assert resolve_activity_type("SWIM") == "Swim"