feat: new settings, CLI skeleton and interface skeletons
Adds the pydantic-settings Settings with validated GITEA_URL, OAuth scopes and toolsets, the argparse CLI skeleton, catalog.model, identity and GiteaAPIError. Test fixtures now isolate env, cwd and state paths in tmp.
This commit is contained in:
1 parent
4ac9626eb5
commit
b82e2866cb
24 files changed
+1512
-605
No files matched your search
@@ -0,0 +1,35 @@
|
||||
"""Tests for request-scoped context variables."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from aegis_gitea_mcp.request_context import (
|
||||
clear_gitea_auth_context,
|
||||
get_gitea_user_login,
|
||||
get_gitea_user_scopes,
|
||||
get_gitea_user_token,
|
||||
get_request_id,
|
||||
set_gitea_user_login,
|
||||
set_gitea_user_scopes,
|
||||
set_gitea_user_token,
|
||||
set_request_id,
|
||||
)
|
||||
|
||||
|
||||
def test_request_id_roundtrip() -> None:
|
||||
set_request_id("req-1")
|
||||
assert get_request_id() == "req-1"
|
||||
|
||||
|
||||
def test_auth_context_set_and_clear() -> None:
|
||||
set_gitea_user_token("tok")
|
||||
set_gitea_user_login("alice")
|
||||
set_gitea_user_scopes([" write:repository", "read:user", "read:user", ""])
|
||||
|
||||
assert get_gitea_user_token() == "tok"
|
||||
assert get_gitea_user_login() == "alice"
|
||||
assert get_gitea_user_scopes() == ("read:user", "write:repository")
|
||||
|
||||
clear_gitea_auth_context()
|
||||
assert get_gitea_user_token() is None
|
||||
assert get_gitea_user_login() is None
|
||||
assert get_gitea_user_scopes() == ()
|
||||
Reference in new issue
Block a user