New router intelligence modules (26 files): alert_ingest/store, audit_store, architecture_pressure, backlog_generator/store, cost_analyzer, data_governance, dependency_scanner, drift_analyzer, incident_* (5 files), llm_enrichment, platform_priority_digest, provider_budget, release_check_runner, risk_* (6 files), signature_state_store, sofiia_auto_router, tool_governance New services: - sofiia-console: Dockerfile, adapters/, monitor/nodes/ops/voice modules, launchd, react static - memory-service: integration_endpoints, integrations, voice_endpoints, static UI - aurora-service: full app suite (analysis, job_store, orchestrator, reporting, schemas, subagents) - sofiia-supervisor: new supervisor service - aistalk-bridge-lite: Telegram bridge lite - calendar-service: CalDAV calendar service with reminders - mlx-stt-service / mlx-tts-service: Apple Silicon speech services - binance-bot-monitor: market monitor service - node-worker: STT/TTS memory providers New tools (9): agent_email, browser_tool, contract_tool, observability_tool, oncall_tool, pr_reviewer_tool, repo_tool, safe_code_executor, secure_vault New crews: agromatrix_crew (10 modules: depth_classifier, doc_facts, doc_focus, farm_state, light_reply, llm_factory, memory_manager, proactivity, reflection_engine, session_context, style_adapter, telemetry) Tests: 85+ test files for all new modules Made-with: Cursor
105 lines
2.7 KiB
Python
105 lines
2.7 KiB
Python
"""
|
|
Test 1: Store and retrieve Gmail credentials
|
|
|
|
Demonstrates:
|
|
- Initialize vault
|
|
- Store multiple credentials
|
|
- Retrieve credentials
|
|
- List credentials
|
|
- Delete credentials
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
import shutil
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
# Use temp vault directory
|
|
temp_dir = tempfile.mkdtemp()
|
|
os.environ["VAULT_DIR"] = temp_dir
|
|
os.environ["VAULT_AUDIT_LOG_DIR"] = temp_dir
|
|
|
|
from secure_vault import SecureVault
|
|
|
|
|
|
def test_gmail_credentials():
|
|
"""Test storing Gmail credentials"""
|
|
|
|
print("=== Test: Gmail Credentials ===\n")
|
|
|
|
# Initialize vault
|
|
print("1. Initializing vault...")
|
|
vault = SecureVault()
|
|
result = vault.init_vault("my-secure-master-password")
|
|
print(f" Vault initialized: {result['status']}")
|
|
|
|
# Store Gmail credentials
|
|
print("\n2. Storing Gmail credentials...")
|
|
|
|
vault.store(
|
|
agent_id="sofiia",
|
|
service="gmail",
|
|
credential_name="password",
|
|
value="your-gmail-password"
|
|
)
|
|
print(" - Stored password")
|
|
|
|
vault.store(
|
|
agent_id="sofiia",
|
|
service="gmail",
|
|
credential_name="oauth_token",
|
|
value={"access_token": "ya29.xxxx", "refresh_token": "1//xxx"}
|
|
)
|
|
print(" - Stored OAuth token")
|
|
|
|
vault.store(
|
|
agent_id="sofiia",
|
|
service="gmail",
|
|
credential_name="app_password",
|
|
value="xxxx xxxx xxxx xxxx",
|
|
ttl_seconds=3600 # 1 hour
|
|
)
|
|
print(" - Stored app password (TTL: 1 hour)")
|
|
|
|
# List services
|
|
print("\n3. Listing services...")
|
|
services = vault.list("sofiia")
|
|
print(f" Services: {services}")
|
|
|
|
# List credentials
|
|
print("\n4. Listing credentials for gmail...")
|
|
creds = vault.list("sofiia", "gmail")
|
|
print(f" Credentials: {creds}")
|
|
|
|
# Retrieve password
|
|
print("\n5. Retrieving password...")
|
|
password = vault.get("sofiia", "gmail", "password")
|
|
print(f" Password retrieved: {password is not None}")
|
|
|
|
# Retrieve OAuth token
|
|
print("\n6. Retrieving OAuth token...")
|
|
token = vault.get("sofiia", "gmail", "oauth_token")
|
|
print(f" Token type: {type(token)}")
|
|
print(f" Has access_token: {'access_token' in token}")
|
|
|
|
# Delete credential
|
|
print("\n7. Deleting app_password...")
|
|
result = vault.delete("sofiia", "gmail", "app_password")
|
|
print(f" Status: {result['status']}")
|
|
|
|
# Verify deletion
|
|
creds = vault.list("sofiia", "gmail")
|
|
print(f" Remaining: {creds}")
|
|
|
|
# Clean up
|
|
shutil.rmtree(temp_dir)
|
|
|
|
print("\n✅ Gmail credentials test passed!")
|
|
return True
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_gmail_credentials()
|