22 lines
981 B
Python
22 lines
981 B
Python
"""Test OAuth detection in provider registry."""
|
|
import pytest
|
|
from nanobot.providers.registry import should_use_oauth_provider
|
|
|
|
|
|
def test_should_use_oauth_for_oat_token():
|
|
"""OAuth provider should be used for sk-ant-oat tokens."""
|
|
assert should_use_oauth_provider("sk-ant-oat01-xxx", "anthropic/claude-opus-4-5") is True
|
|
assert should_use_oauth_provider("sk-ant-oat01-xxx", "claude-sonnet-4") is True
|
|
|
|
|
|
def test_should_not_use_oauth_for_regular_key():
|
|
"""Regular API keys should not use OAuth provider."""
|
|
assert should_use_oauth_provider("sk-ant-api03-xxx", "claude-opus-4-5") is False
|
|
assert should_use_oauth_provider("sk-or-v1-xxx", "anthropic/claude-opus-4-5") is False
|
|
|
|
|
|
def test_should_not_use_oauth_for_non_anthropic():
|
|
"""Non-Anthropic models should not use OAuth provider."""
|
|
assert should_use_oauth_provider("sk-ant-oat01-xxx", "gpt-4") is False
|
|
assert should_use_oauth_provider("sk-ant-oat01-xxx", "deepseek/deepseek-chat") is False
|