Demo
REFERENCE

testzeus-auth

AUTO-GENERATEDBUILD 2026.12.05

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

bash
# Login
testzeus auth login

# Check status
testzeus auth whoami

# Logout
testzeus auth logout

# Use profile
testzeus --profile dev tests list

Authentication Methods

1. Interactive Login (CLI)

bash
# 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/api

You'll be prompted for:

  • Email address
  • Password (hidden input)

2. Environment Variables (SDK/CI)

bash
export TESTZEUS_EMAIL="user@example.com"
export TESTZEUS_PASSWORD="your-password"

Or in your Python code:

python
import os
os.environ["TESTZEUS_EMAIL"] = "user@example.com"
os.environ["TESTZEUS_PASSWORD"] = "your-password"

3. Programmatic Login (SDK)

python
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:

bash
# Create new profile
testzeus auth login --profile dev

# Profile for staging environment
testzeus auth login --profile staging

# Profile for production
testzeus auth login --profile prod

Using Profiles

bash
# Run commands with specific profile
testzeus --profile dev tests list
testzeus --profile prod tests list

# Set default profile
# Edit ~/.testzeus/config.yaml

Listing Profiles

bash
# View config file
cat ~/.testzeus/config.yaml

Sample config:

yaml
default:
  base_url: https://prod.testzeus.app/api

profiles:
  dev:
    base_url: https://prod.testzeus.app/api
  staging:
    base_url: https://prod.testzeus.app/api

Session Management

Check Current Session

bash
testzeus auth whoami

Output:

text
Logged in as: user@example.com
Tenant: My Company
Profile: default
Session expires: 2025-12-31 23:59:59

Logout

bash
# Logout from current profile
testzeus auth logout

# Logout from specific profile
testzeus --profile dev auth logout

Session Persistence

  • Credentials stored in system keyring (secure)
  • Session tokens cached locally
  • Automatic token refresh when possible

SDK Authentication

Async Client

python
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

python
from testzeus_sdk import TestZeusClient

# Automatically handles login/logout
async with TestZeusClient(email="user@example.com", password="pass") as client:
    # Work with authenticated client
    pass

Manual Authentication

python
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:

  1. Check email/password are correct
  2. Reset password at https://app.testzeus.ai/reset-password
  3. Ensure Caps Lock is off
  4. Try re-entering credentials

Session Expired

Error: Session expired, please login again

Solutions:

bash
# Re-authenticate
testzeus auth logout
testzeus auth login

# Or force token refresh
testzeus --force-auth tests list

Profile Issues

Error: Profile 'xyz' not found

Solutions:

bash
# List available profiles
cat ~/.testzeus/config.yaml

# Create missing profile
testzeus auth login --profile xyz

Wrong Tenant/Workspace

Issue: Seeing tests/data from wrong workspace

Solutions:

bash
# Check current tenant
testzeus auth whoami

# Login to correct tenant
testzeus auth login --profile work

# Or explicitly specify
testzeus --profile work tests list

API Key Authentication (Advanced)

If your organization uses API keys:

bash
export TESTZEUS_API_KEY="your-api-key"
testzeus tests list

SDK:

python
client = TestZeusClient(api_key="your-api-key")

Security Best Practices

  1. Never commit credentials - Use environment variables
  2. Use profiles - Separate dev/prod credentials
  3. Rotate passwords - Regularly update passwords
  4. Use keyring - CLI stores credentials securely
  5. Audit sessions - Check whoami before 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:

json
{
  "component": "AuthStatus",
  "props": {
    "authenticated": true,
    "email": "user@example.com",
    "tenant": "My Company",
    "profile": "default",
    "expires_at": "2025-12-31T23:59:59Z"
  }
}