import asyncio from src.core.database import SessionLocal from src.models.git import GitServerConfig, GitProvider from src.api.routes.git_schemas import GitServerConfigCreate from src.api.routes.git import test_git_config async def run(): db = SessionLocal() config_create = GitServerConfigCreate( name="test", provider=GitProvider.GITEA, url="https://git.bebesh.ru", pat="********", config_id="f3e7652c-b850-4df9-9773-99e7f9d73dea" ) # Let's mock git_service.test_connection to see what PAT it gets it from src.api.routes import git original_test = git.git_service.test_connection async def mock_test(provider, url, pat): print(f"PAT received by mock: '{pat}'") return True git.git_service.test_connection = mock_test try: await test_git_config(config_create, db=db) finally: git.git_service.test_connection = original_test asyncio.run(run())