Add JWT base_url validation tests

Add 2 additional JWT authentication tests:
- test_init_with_empty_base_url_raises_error
- test_init_with_whitespace_base_url_raises_error

Improves JWT auth coverage slightly and adds validation coverage
for base_url parameter.

Tests: 442 → 444 (+2)
Coverage: 79.32% → 79.35% (+0.03%)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2025-10-23 01:57:17 +00:00
parent 5a62a11429
commit 8f6a81154c

View File

@@ -52,6 +52,16 @@ class TestJWTAuth:
with pytest.raises(ValueError, match="JWT token cannot be empty"): with pytest.raises(ValueError, match="JWT token cannot be empty"):
JWTAuth(None, mock_wiki_base_url) JWTAuth(None, mock_wiki_base_url)
def test_init_with_empty_base_url_raises_error(self, mock_jwt_token):
"""Test that empty base URL raises ValueError."""
with pytest.raises(ValueError, match="Base URL cannot be empty"):
JWTAuth(mock_jwt_token, "")
def test_init_with_whitespace_base_url_raises_error(self, mock_jwt_token):
"""Test that whitespace-only base URL raises ValueError."""
with pytest.raises(ValueError, match="Base URL cannot be empty"):
JWTAuth(mock_jwt_token, " ")
def test_get_headers_returns_bearer_token(self, jwt_auth, mock_jwt_token): def test_get_headers_returns_bearer_token(self, jwt_auth, mock_jwt_token):
"""Test that get_headers returns proper Authorization header.""" """Test that get_headers returns proper Authorization header."""
headers = jwt_auth.get_headers() headers = jwt_auth.get_headers()