Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,29 @@ addopts = [
"--self-contained-html",
"--json-report",
"--json-report-file=tests/reports/report.json",
"-v", # Verbose output
]
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
markers = [
"unit: Unit tests",
"integration: Integration tests",
"e2e: End-to-end tests",
"auth: Authentication tests",
"servers: Server management tests",
"search: Search and AI tests",
"unit: Unit tests (isolated components)",
"integration: Integration tests (component interaction)",
"e2e: End-to-end tests (complete workflows)",
"auth: Authentication and authorization tests",
"servers: Server management tests",
"search: Search and FAISS tests",
"health: Health monitoring tests",
"core: Core infrastructure tests",
"slow: Slow running tests",
"cli: CLI tools tests",
"scopes: Scopes manager tests",
"internal_api: Internal API tests",
"gateway: MCP Gateway server tests",
"slow: Slow running tests (>5s)",
"critical: Critical path tests (require 95% coverage)",
]

# Coverage Configuration
Expand Down
Empty file.
25 changes: 21 additions & 4 deletions tests/unit/auth/test_auth_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
oauth2_login_redirect,
oauth2_callback,
login_submit,
logout
logout_get,
logout_post
)


Expand Down Expand Up @@ -275,9 +276,25 @@ async def test_login_submit_failure(self):
assert "Invalid+username+or+password" in response.headers["location"]

@pytest.mark.asyncio
async def test_logout(self, mock_settings):
"""Test logout functionality."""
response = await logout()
async def test_logout_get(self, mock_request, mock_settings):
"""Test logout functionality via GET."""
response = await logout_get(mock_request, session=None)

assert isinstance(response, RedirectResponse)
assert response.status_code == 303
assert response.headers["location"] == "/login"

# Check that cookie deletion header is present
cookie_headers = [h for h in response.raw_headers if h[0] == b'set-cookie']
assert len(cookie_headers) > 0
cookie_value = cookie_headers[0][1].decode()
assert mock_settings.session_cookie_name in cookie_value
assert "expires=" in cookie_value.lower() # Cookie deletion sets expires in past

@pytest.mark.asyncio
async def test_logout_post(self, mock_request, mock_settings):
"""Test logout functionality via POST."""
response = await logout_post(mock_request, session=None)

assert isinstance(response, RedirectResponse)
assert response.status_code == 303
Expand Down
160 changes: 0 additions & 160 deletions tests/unit/services/test_access_control_service.py

This file was deleted.