Dianel555/DSkills / skills/ace-tool
ace-tool
VerifiedSemantic codebase search, code indexing, and prompt enhancement via standalone CLI. Use when: (1) Semantic code search with natural language queries, (2) Code indexing for remote codebase retrieval, (3) Prompt enhancement with codebase context, (4) Before grep/find/glob operations for better accuracy, (5) Complex requirements clarification, (6) Large codebase navigation. Triggers: "search context", "enhance prompt", "find code that", "index project", "clarify requirements". IMPORTANT: Always use ace-tool BEFORE grep/find/glob for semantic-level code location.
tests/test_client_auth_integration.py
View on GitHub"""Tests for AceToolClient authentication integration."""
import json
import os
from unittest.mock import patch
try:
from scripts.client import AceToolClient
except ImportError:
from client import AceToolClient
class TestClientAuthIntegration:
"""Test AceToolClient uses load_session_auth() correctly."""
def test_constructor_params_override_all(self, tmp_path):
"""Test constructor parameters take highest priority."""
session_file = tmp_path / ".augment" / "session.json"
session_file.parent.mkdir(parents=True)
session_data = {"accessToken": "file_token", "tenantURL": "https://file.example.com/"}
session_file.write_text(json.dumps(session_data), encoding="utf-8")
env_vars = {"ACE_API_URL": "https://env.example.com/", "ACE_API_TOKEN": "env_token"}
with patch("pathlib.Path.home", return_value=tmp_path), patch.dict(os.environ, env_vars, clear=False):
client = AceToolClient(base_url="https://constructor.example.com", token="constructor_token")
assert client.base_url == "https://constructor.example.com"
assert client.token == "constructor_token"
assert client.auth_source == "constructor"
def test_session_json_used_when_no_constructor_params(self, tmp_path):
"""Test session.json used when constructor params not provided."""
session_file = tmp_path / ".augment" / "session.json"
session_file.parent.mkdir(parents=True)
session_data = {"accessToken": "session_token", "tenantURL": "https://session.example.com/"}
session_file.write_text(json.dumps(session_data), encoding="utf-8")
with patch("pathlib.Path.home", return_value=tmp_path):
client = AceToolClient()
assert client.base_url == "https://session.example.com"
assert client.token == "session_token"
assert client.auth_source == "session.json"
def test_augment_session_auth_fallback(self, tmp_path):
"""Test AUGMENT_SESSION_AUTH used when session.json missing."""
env_data = {"accessToken": "env_token", "tenantURL": "https://env.example.com/"}
env_vars = {"AUGMENT_SESSION_AUTH": json.dumps(env_data)}
with patch("pathlib.Path.home", return_value=tmp_path), patch.dict(os.environ, env_vars, clear=False):
client = AceToolClient()
assert client.base_url == "https://env.example.com"
assert client.token == "env_token"
assert client.auth_source == "AUGMENT_SESSION_AUTH"
def test_legacy_env_vars_lowest_priority(self, tmp_path):
"""Test legacy ACE_API_* vars used as last resort."""
env_vars = {
"ACE_API_URL": "https://legacy.example.com/",
"ACE_API_TOKEN": "legacy_token",
"AUGMENT_SESSION_AUTH": "",
}
with patch("pathlib.Path.home", return_value=tmp_path), patch.dict(os.environ, env_vars, clear=False):
client = AceToolClient()
assert client.base_url == "https://legacy.example.com"
assert client.token == "legacy_token"
assert client.auth_source == "ACE_API_TOKEN"
def test_partial_constructor_params(self, tmp_path):
"""Test partial constructor params override only those fields."""
session_file = tmp_path / ".augment" / "session.json"
session_file.parent.mkdir(parents=True)
session_data = {"accessToken": "session_token", "tenantURL": "https://session.example.com/"}
session_file.write_text(json.dumps(session_data), encoding="utf-8")
with patch("pathlib.Path.home", return_value=tmp_path):
client = AceToolClient(token="override_token")
# Only token overridden, base_url from session.json
assert client.base_url == "https://session.example.com"
assert client.token == "override_token"
assert client.auth_source == "constructor"
def test_no_auth_configured(self, tmp_path):
"""Test client handles missing authentication gracefully."""
env_vars = {"ACE_API_URL": "", "ACE_API_TOKEN": "", "AUGMENT_SESSION_AUTH": ""}
with patch("pathlib.Path.home", return_value=tmp_path), patch.dict(os.environ, env_vars, clear=False):
client = AceToolClient()
assert client.base_url == ""
assert client.token == ""
assert client.auth_source == "none"
def test_auth_source_in_get_config(self, tmp_path):
"""Test get_config() includes auth_source field."""
session_file = tmp_path / ".augment" / "session.json"
session_file.parent.mkdir(parents=True)
session_data = {"accessToken": "token", "tenantURL": "https://example.com/"}
session_file.write_text(json.dumps(session_data), encoding="utf-8")
with patch("pathlib.Path.home", return_value=tmp_path):
client = AceToolClient()
config = client.get_config()
assert "auth_source" in config
assert config["auth_source"] == "session.json"
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |