"""Test provider factory with OAuth support."""
import pytest
from nanobot.providers import create_provider
from nanobot.providers.anthropic_oauth import AnthropicOAuthProvider
from nanobot.providers.litellm_provider import LiteLLMProvider


def test_create_provider_oauth_token():
    """OAuth tokens should create AnthropicOAuthProvider."""
    provider = create_provider(
        api_key="sk-ant-oat01-test-token",
        model="anthropic/claude-opus-4-5"
    )
    assert isinstance(provider, AnthropicOAuthProvider)


def test_create_provider_regular_key():
    """Regular API keys should create LiteLLMProvider."""
    provider = create_provider(
        api_key="sk-ant-api03-regular-key",
        model="anthropic/claude-opus-4-5"
    )
    assert isinstance(provider, LiteLLMProvider)


def test_create_provider_openrouter():
    """OpenRouter keys should create LiteLLMProvider."""
    provider = create_provider(
        api_key="sk-or-v1-xxx",
        model="anthropic/claude-opus-4-5"
    )
    assert isinstance(provider, LiteLLMProvider)
