testzeus-auth
Authentication, profile management, and session handling for TestZeus.
Category: infrastructure · Version: 1.0.0 · Requires: testzeus-installation
Triggers: login, logout, authenticate, whoami, switch profile, change account, check auth, multiple workspaces, credentials, session, authentication
Overview
This skill guides you through authentication with TestZeus, including profile management, session handling, and troubleshooting auth issues.
Quick Reference
# Login
testzeus auth login
# Check status
testzeus auth whoami
# Logout
testzeus auth logout
# Use profile
testzeus --profile dev tests listAuthentication Methods
1. Interactive Login (CLI)
# Basic login
testzeus auth login
# Login with specific profile
testzeus auth login --profile work
# Login to specific API endpoint
testzeus auth login --api-url https://prod.testzeus.app/apiYou'll be prompted for:
- Email address
- Password (hidden input)
2. Environment Variables (SDK/CI)
export TESTZEUS_EMAIL="user@example.com"
export TESTZEUS_PASSWORD="your-password"Or in your Python code:
import os
os.environ["TESTZEUS_EMAIL"] = "user@example.com"
os.environ["TESTZEUS_PASSWORD"] = "your-password"3. Programmatic Login (SDK)
from testzeus_sdk import TestZeusClient
# Direct credentials
client = TestZeusClient(
email="user@example.com",
password="your-password"
)
# Or with custom base URL
client = TestZeusClient(
email="user@example.com",
password="your-password",
base_url="https://prod.testzeus.app/api"
)Profile Management
Creating Profiles
Profiles allow you to switch between different TestZeus environments/accounts:
# Create new profile
testzeus auth login --profile dev
# Profile for staging environment
testzeus auth login --profile staging
# Profile for production
testzeus auth login --profile prodUsing Profiles
# Run commands with specific profile
testzeus --profile dev tests list
testzeus --profile prod tests list
# Set default profile
# Edit ~/.testzeus/config.yamlListing Profiles
# View config file
cat ~/.testzeus/config.yamlSample config:
default:
base_url: https://prod.testzeus.app/api
profiles:
dev:
base_url: https://prod.testzeus.app/api
staging:
base_url: https://prod.testzeus.app/apiSession Management
Check Current Session
testzeus auth whoamiOutput:
Logged in as: user@example.com
Tenant: My Company
Profile: default
Session expires: 2025-12-31 23:59:59Logout
# Logout from current profile
testzeus auth logout
# Logout from specific profile
testzeus --profile dev auth logoutSession Persistence
- Credentials stored in system keyring (secure)
- Session tokens cached locally
- Automatic token refresh when possible
SDK Authentication
Async Client
import asyncio
from testzeus_sdk import TestZeusClient
async def main():
async with TestZeusClient() as client:
# Client is now authenticated
tests = await client.tests.get_list(limit=10)
print(f"Found {tests['total']} tests")
asyncio.run(main())Context Manager Pattern
from testzeus_sdk import TestZeusClient
# Automatically handles login/logout
async with TestZeusClient(email="user@example.com", password="pass") as client:
# Work with authenticated client
passManual Authentication
from testzeus_sdk import TestZeusClient
client = TestZeusClient()
await client.authenticate("user@example.com", "password")
# ... use client ...
client.logout()Troubleshooting
Authentication Failed
Error: Authentication failed: Invalid credentials
Solutions:
- Check email/password are correct
- Reset password at https://app.testzeus.ai/reset-password
- Ensure Caps Lock is off
- Try re-entering credentials
Session Expired
Error: Session expired, please login again
Solutions:
# Re-authenticate
testzeus auth logout
testzeus auth login
# Or force token refresh
testzeus --force-auth tests listProfile Issues
Error: Profile 'xyz' not found
Solutions:
# List available profiles
cat ~/.testzeus/config.yaml
# Create missing profile
testzeus auth login --profile xyzWrong Tenant/Workspace
Issue: Seeing tests/data from wrong workspace
Solutions:
# Check current tenant
testzeus auth whoami
# Login to correct tenant
testzeus auth login --profile work
# Or explicitly specify
testzeus --profile work tests listAPI Key Authentication (Advanced)
If your organization uses API keys:
export TESTZEUS_API_KEY="your-api-key"
testzeus tests listSDK:
client = TestZeusClient(api_key="your-api-key")Security Best Practices
- Never commit credentials - Use environment variables
- Use profiles - Separate dev/prod credentials
- Rotate passwords - Regularly update passwords
- Use keyring - CLI stores credentials securely
- Audit sessions - Check
whoamibefore sensitive operations
Environment Variable Reference
| Variable | Description | Required |
|---|---|---|
TESTZEUS_EMAIL |
User email | For SDK |
TESTZEUS_PASSWORD |
User password | For SDK |
TESTZEUS_BASE_URL |
API base URL | No (has default) |
TESTZEUS_API_KEY |
API key | Alternative to password |
TESTZEUS_PROFILE |
Default profile | No |
Component Schema
Use the AuthStatus component:
{
"component": "AuthStatus",
"props": {
"authenticated": true,
"email": "user@example.com",
"tenant": "My Company",
"profile": "default",
"expires_at": "2025-12-31T23:59:59Z"
}
}Related Skills
- testzeus-installation - Installing TestZeus
- testzeus-test-operations - Running tests (requires auth)