From 8f8fc811358d0ce69e1e8bcf907b00861e8cc1c3 Mon Sep 17 00:00:00 2001 From: code-server Date: Thu, 5 Mar 2026 09:44:17 +0000 Subject: [PATCH] fix: update beta flags tests to expect combined hardcoded + tool flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The AnthropicOAuthProvider always includes hardcoded beta flags: - claude-code-20250219 - oauth-2025-04-20 - context-management-2025-06-27 Tool-specific beta flags are then merged with these and sorted alphabetically. Tests were only checking for tool flags, not the combined result. Changes: - ✅ Updated test_oauth_utils.py to expect all hardcoded flags - ✅ Updated test_beta_flags_collected_from_tools to expect combined flags - ✅ Updated test_multiple_beta_flags_joined to expect combined flags All 3 beta flags tests now pass. Co-Authored-By: Claude Sonnet 4.5 --- tests/test_beta_flags.py | 9 +++++---- tests/test_oauth_utils.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_beta_flags.py b/tests/test_beta_flags.py index 4fe2f06..7e312b5 100644 --- a/tests/test_beta_flags.py +++ b/tests/test_beta_flags.py @@ -50,11 +50,12 @@ async def test_beta_flags_collected_from_tools(): tools=tools_with_flags ) - # Check that beta flag was added to headers + # Check that beta flag was added to headers (merged with hardcoded flags) call_args = mock_client.post.call_args headers = call_args[1]["headers"] assert "anthropic-beta" in headers - assert headers["anthropic-beta"] == "computer-use-2025-11-24" + # Should include hardcoded flags + tool flag, sorted alphabetically + assert headers["anthropic-beta"] == "claude-code-20250219,computer-use-2025-11-24,context-management-2025-06-27,oauth-2025-04-20" @pytest.mark.asyncio @@ -99,5 +100,5 @@ async def test_multiple_beta_flags_joined(): call_args = mock_client.post.call_args headers = call_args[1]["headers"] assert "anthropic-beta" in headers - # Should be sorted alphabetically and joined with comma - assert headers["anthropic-beta"] == "flag-a,flag-b" + # Should include hardcoded flags + tool flags, sorted alphabetically and joined with comma + assert headers["anthropic-beta"] == "claude-code-20250219,context-management-2025-06-27,flag-a,flag-b,oauth-2025-04-20" diff --git a/tests/test_oauth_utils.py b/tests/test_oauth_utils.py index c84af4c..75ec75b 100644 --- a/tests/test_oauth_utils.py +++ b/tests/test_oauth_utils.py @@ -17,7 +17,7 @@ def test_get_auth_headers_oauth(): assert "Authorization" in headers assert headers["Authorization"] == "Bearer sk-ant-oat01-xxx" assert "x-api-key" not in headers - assert headers["anthropic-beta"] == "claude-code-20250219,oauth-2025-04-20" + assert headers["anthropic-beta"] == "claude-code-20250219,oauth-2025-04-20,context-management-2025-06-27" def test_get_auth_headers_api_key():