Meta Ads (Facebook/Instagram) MCP server for Claude, ChatGPT, Perplexity & Cursor — the Meta node of Pipeboard’s 5-platform family (+ Google, TikTok, Snap, Reddit). Hosted remote MCP, badged Meta Business Partner, free plan — no self-hosting required.
Python advertisingai-agentschatgptclaudefacebook-adsinstagram-adsmcpmeta-adsmodel-context-protocolpipeboard
fix(tests): Update test mocks to patch auth.get_current_access_token
Yves Junqueira77b2266f91af
diff --git a/tests/test_account_info_access_fix.py b/tests/test_account_info_access_fix.pyindex c61d0ca..ec84582 100644--- a/tests/test_account_info_access_fix.py+++ b/tests/test_account_info_access_fix.py@@ -38,7 +38,7 @@ class TestAccountInfoAccessFix:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_account_response@@ -95,7 +95,7 @@ class TestAccountInfoAccessFix:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"# First call returns permission error, second call returns accessible accounts@@ -158,7 +158,7 @@ class TestAccountInfoAccessFix:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_error_response@@ -180,7 +180,7 @@ class TestAccountInfoAccessFix:async def test_account_info_missing_account_id_error(self):"""Test that missing account_id parameter returns appropriate error"""- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"result = await get_account_info(account_id=None)@@ -207,7 +207,7 @@ class TestAccountInfoAccessFix:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_account_response@@ -236,7 +236,7 @@ class TestAccountInfoAccessFix:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_account_response@@ -272,7 +272,7 @@ class TestAccountInfoAccessRegression:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_account_responsediff --git a/tests/test_budget_update.py b/tests/test_budget_update.pyindex 60b596b..fc59590 100644--- a/tests/test_budget_update.py+++ b/tests/test_budget_update.py@@ -40,7 +40,7 @@ class TestBudgetUpdateFunctionality:def mock_auth_manager(self):"""Mock for the authentication manager"""with patch('meta_ads_mcp.core.api.auth_manager') as mock, \- patch('meta_ads_mcp.core.api.get_current_access_token') as mock_get_token:+ patch('meta_ads_mcp.core.auth.get_current_access_token') as mock_get_token:# Mock a valid access tokenmock.get_current_access_token.return_value = "test_access_token"mock.is_token_valid.return_value = True@@ -433,7 +433,7 @@ class TestBudgetUpdateIntegration:# Test that the function accepts the new parameterswith patch('meta_ads_mcp.core.adsets.make_api_request') as mock_api, \patch('meta_ads_mcp.core.api.auth_manager') as mock_auth, \- patch('meta_ads_mcp.core.api.get_current_access_token') as mock_get_token:+ patch('meta_ads_mcp.core.auth.get_current_access_token') as mock_get_token:mock_api.return_value = {"id": "test_id", "daily_budget": "5000"}mock_auth.get_current_access_token.return_value = "test_access_token"diff --git a/tests/test_dsa_beneficiary.py b/tests/test_dsa_beneficiary.pyindex c3dec9a..071a3c9 100644--- a/tests/test_dsa_beneficiary.py+++ b/tests/test_dsa_beneficiary.py@@ -30,7 +30,7 @@ class TestDSABeneficiaryDetection:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_account_response@@ -62,7 +62,7 @@ class TestDSABeneficiaryDetection:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_account_response@@ -81,7 +81,7 @@ class TestDSABeneficiaryDetection:async def test_dsa_requirement_detection_error_handling(self):"""Test error handling when account info cannot be retrieved"""with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.side_effect = Exception("API Error")@@ -100,7 +100,7 @@ class TestDSABeneficiaryDetection:async def test_account_info_requires_account_id(self):"""Test that get_account_info requires an account_id parameter"""- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"# Test without account_id parameter@@ -140,7 +140,7 @@ class TestDSABeneficiaryDetection:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"# First call returns permission error, second call returns accessible accountsmock_api.side_effect = [mock_permission_error, mock_accessible_accounts]@@ -175,7 +175,7 @@ class TestDSABeneficiaryParameter:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_response@@ -209,7 +209,7 @@ class TestDSABeneficiaryParameter:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.side_effect = Exception("DSA beneficiary required for European compliance")@@ -237,7 +237,7 @@ class TestDSABeneficiaryParameter:async def test_create_adset_without_dsa_beneficiary_dsa_required(self):"""Test error when DSA beneficiary is required but not provided"""with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.side_effect = Exception("Enter the person or organization that benefits from ads in this ad set")@@ -265,7 +265,7 @@ class TestDSABeneficiaryParameter:async def test_create_adset_dsa_beneficiary_in_targeting(self):"""Test that DSA beneficiary is not added to targeting spec"""with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = {"id": "23842588888640185"}@@ -300,7 +300,7 @@ class TestDSABeneficiaryParameter:for beneficiary_name in test_cases:with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = {"id": "23842588888640185"}@@ -326,7 +326,7 @@ class TestDSAPermissionHandling:async def test_dsa_beneficiary_missing_business_management_permission(self):"""Test error handling when business_management permissions are missing"""with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.side_effect = Exception("Permission denied: business_management permission required")@@ -354,7 +354,7 @@ class TestDSAPermissionHandling:async def test_dsa_beneficiary_api_limitation_handling(self):"""Test handling when API doesn't support dsa_beneficiary parameter"""with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.side_effect = Exception("Parameter dsa_beneficiary is not supported")@@ -397,7 +397,7 @@ class TestDSARegionalCompliance:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_account_response@@ -422,7 +422,7 @@ class TestDSARegionalCompliance:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_account_response@@ -451,7 +451,7 @@ class TestDSARegionalCompliance:# Test European accountwith patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = european_mock_response@@ -462,7 +462,7 @@ class TestDSARegionalCompliance:# Test US accountwith patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = us_mock_response@@ -487,7 +487,7 @@ class TestDSAErrorHandling:for error_message, expected_keyword in error_scenarios:with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.side_effect = Exception(error_message)@@ -514,7 +514,7 @@ class TestDSAErrorHandling:async def test_dsa_beneficiary_fallback_behavior(self):"""Test fallback behavior for unexpected DSA-related errors"""with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.side_effect = Exception("Unexpected DSA-related error")@@ -562,7 +562,7 @@ class TestDSABeneficiaryRetrieval:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_adset_response@@ -595,7 +595,7 @@ class TestDSABeneficiaryRetrieval:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_adset_response@@ -625,7 +625,7 @@ class TestDSABeneficiaryRetrieval:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_adset_response@@ -640,7 +640,7 @@ class TestDSABeneficiaryRetrieval:async def test_get_adset_details_dsa_beneficiary_field_requested(self):"""Test that the API request includes dsa_beneficiary in the fields parameter"""with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = {"id": "120229746629010183"}@@ -655,7 +655,7 @@ class TestDSABeneficiaryRetrieval:async def test_get_adset_details_error_handling(self):"""Test error handling when retrieving ad set details fails"""with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.side_effect = Exception("Ad set not found")diff --git a/tests/test_dsa_integration.py b/tests/test_dsa_integration.pyindex 2f6197d..7009598 100644--- a/tests/test_dsa_integration.py+++ b/tests/test_dsa_integration.py@@ -32,7 +32,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_account_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_account_api.return_value = mock_account_response@@ -59,7 +59,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_adset_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_adset_api.return_value = mock_adset_response@@ -100,7 +100,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.side_effect = Exception(json.dumps(mock_error_response))@@ -127,7 +127,7 @@ class TestDSAIntegration:# Test 2: Permission error for DSA beneficiarywith patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.side_effect = Exception("Permission denied: business_management permission required")@@ -165,7 +165,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_de_account_response@@ -190,7 +190,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_us_account_response@@ -228,7 +228,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_response@@ -259,7 +259,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_create_response@@ -298,7 +298,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_details_response@@ -329,7 +329,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_us_account_response@@ -348,7 +348,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_create_response@@ -383,7 +383,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.adsets.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"mock_api.return_value = mock_details_response@@ -398,7 +398,7 @@ class TestDSAIntegration:async def test_account_info_requires_account_id(self):"""Test that get_account_info requires an account_id parameter"""- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"# Test without account_id parameter@@ -438,7 +438,7 @@ class TestDSAIntegration:}with patch('meta_ads_mcp.core.accounts.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_access_token"# First call returns permission error, second call returns accessible accountsmock_api.side_effect = [mock_permission_error, mock_accessible_accounts]diff --git a/tests/test_duplication.py b/tests/test_duplication.pyindex 699ce88..c151b1e 100644--- a/tests/test_duplication.py+++ b/tests/test_duplication.py@@ -54,7 +54,7 @@ async def test_forward_duplication_request_no_facebook_token():mock_auth.get_auth_token.return_value = None # No Facebook token# Mock get_current_access_token to also return None- with patch("meta_ads_mcp.core.duplication.get_current_access_token") as mock_get_token:+ with patch("meta_ads_mcp.core.auth.get_current_access_token") as mock_get_token:mock_get_token.return_value = Noneresult = await _forward_duplication_request("campaign", "123456789", None, {})diff --git a/tests/test_duplication_regression.py b/tests/test_duplication_regression.pyindex 12ba588..8171d2b 100644--- a/tests/test_duplication_regression.py+++ b/tests/test_duplication_regression.py@@ -238,7 +238,7 @@ class TestDuplicationErrorHandling:mock_auth.get_pipeboard_token.return_value = "pipeboard_token" # Has Pipeboard tokenmock_auth.get_auth_token.return_value = None # No Facebook token- with patch("meta_ads_mcp.core.duplication.get_current_access_token") as mock_get_token:+ with patch("meta_ads_mcp.core.auth.get_current_access_token") as mock_get_token:mock_get_token.return_value = None # No fallback tokenresult = await duplication._forward_duplication_request("campaign", "123", None, {})diff --git a/tests/test_estimate_audience_size.py b/tests/test_estimate_audience_size.pyindex 4562772..ce38c33 100644--- a/tests/test_estimate_audience_size.py+++ b/tests/test_estimate_audience_size.py@@ -280,7 +280,7 @@ class TestEstimateAudienceSize:"""Test error when no parameters provided"""# Since we're using the @meta_api_tool decorator, we need to simulate# its behavior for error handling- with patch('meta_ads_mcp.core.api.get_current_access_token') as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token') as mock_auth:mock_auth.return_value = "test_token"result = await estimate_audience_size()diff --git a/tests/test_get_account_pages.py b/tests/test_get_account_pages.pyindex 5c0af89..af37087 100644--- a/tests/test_get_account_pages.py+++ b/tests/test_get_account_pages.py@@ -77,7 +77,7 @@ class TestGetAccountPages:}}- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth, \+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth, \patch('meta_ads_mcp.core.ads.make_api_request') as mock_api:mock_auth.return_value = "test_access_token"@@ -145,7 +145,7 @@ class TestGetAccountPages:]}- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth, \+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth, \patch('meta_ads_mcp.core.ads.make_api_request') as mock_api:mock_auth.return_value = "test_access_token"@@ -189,7 +189,7 @@ class TestGetAccountPages:"category": "Business"}- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth, \+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth, \patch('meta_ads_mcp.core.ads.make_api_request') as mock_api:mock_auth.return_value = "test_access_token"@@ -228,7 +228,7 @@ class TestGetAccountPages:@pytest.mark.asyncioasync def test_get_account_pages_no_pages_found(self):"""Test when no pages are found through any approach."""- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth, \+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth, \patch('meta_ads_mcp.core.ads.make_api_request') as mock_api:mock_auth.return_value = "test_access_token"@@ -247,7 +247,7 @@ class TestGetAccountPages:@pytest.mark.asyncioasync def test_get_account_pages_error_handling(self):"""Test error handling when API calls fail."""- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth, \+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth, \patch('meta_ads_mcp.core.ads.make_api_request') as mock_api:mock_auth.return_value = "test_access_token"@@ -312,7 +312,7 @@ class TestGetAccountPages:from meta_ads_mcp.core.ads import get_account_pages# Mock the function to bypass decorator authentication- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth:mock_auth.return_value = "test_token"# Call with empty string (should be treated as None)@@ -347,7 +347,7 @@ class TestGetAccountPages:"222222222": {"id": "222222222", "name": "Page 2"}}- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth, \+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth, \patch('meta_ads_mcp.core.ads.make_api_request') as mock_api:mock_auth.return_value = "test_access_token"@@ -374,7 +374,7 @@ class TestGetAccountPages:@pytest.mark.asyncioasync def test_get_account_pages_act_prefix_handling(self):"""Test that account IDs without 'act_' prefix are handled correctly."""- with patch('meta_ads_mcp.core.api.get_current_access_token', new_callable=AsyncMock) as mock_auth, \+ with patch('meta_ads_mcp.core.auth.get_current_access_token', new_callable=AsyncMock) as mock_auth, \patch('meta_ads_mcp.core.ads.make_api_request') as mock_api:mock_auth.return_value = "test_access_token"diff --git a/tests/test_insights_actions_and_values_e2e.py b/tests/test_insights_actions_and_values_e2e.pyindex 7348579..fd5cb02 100644--- a/tests/test_insights_actions_and_values_e2e.py+++ b/tests/test_insights_actions_and_values_e2e.py@@ -63,7 +63,7 @@ class TestInsightsActionsAndValues:def mock_auth_manager(self):"""Mock for the authentication manager"""with patch('meta_ads_mcp.core.api.auth_manager') as mock, \- patch('meta_ads_mcp.core.api.get_current_access_token') as mock_get_token:+ patch('meta_ads_mcp.core.auth.get_current_access_token') as mock_get_token:# Mock a valid access tokenmock.get_current_access_token.return_value = "test_access_token"mock.is_token_valid.return_value = Truediff --git a/tests/test_insights_pagination.py b/tests/test_insights_pagination.pyindex 11c4e4e..651070d 100644--- a/tests/test_insights_pagination.py+++ b/tests/test_insights_pagination.py@@ -13,7 +13,7 @@ class TestInsightsPagination:def mock_auth_manager(self):"""Mock for the authentication manager"""with patch('meta_ads_mcp.core.api.auth_manager') as mock, \- patch('meta_ads_mcp.core.api.get_current_access_token') as mock_get_token:+ patch('meta_ads_mcp.core.auth.get_current_access_token') as mock_get_token:# Mock a valid access tokenmock.get_current_access_token.return_value = "test_access_token"mock.is_token_valid.return_value = Truediff --git a/tests/test_mobile_app_adset_creation.py b/tests/test_mobile_app_adset_creation.pyindex fd7e73f..efbc5d2 100644--- a/tests/test_mobile_app_adset_creation.py+++ b/tests/test_mobile_app_adset_creation.py@@ -52,7 +52,7 @@ class TestMobileAppAdsetCreation:def mock_auth_manager(self):"""Mock for the authentication manager"""with patch('meta_ads_mcp.core.api.auth_manager') as mock, \- patch('meta_ads_mcp.core.api.get_current_access_token') as mock_get_token:+ patch('meta_ads_mcp.core.auth.get_current_access_token') as mock_get_token:# Mock a valid access tokenmock.get_current_access_token.return_value = "test_access_token"mock.is_token_valid.return_value = Truediff --git a/tests/test_targeting.py b/tests/test_targeting.pyindex 8380adf..30b9c11 100644--- a/tests/test_targeting.py+++ b/tests/test_targeting.py@@ -84,7 +84,7 @@ class TestSearchInterests:# Mock both the API request and the auth system to bypass decorator issueswith patch('meta_ads_mcp.core.targeting.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token') as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token') as mock_auth:mock_auth.return_value = "test_token"mock_api.return_value = mock_response@@ -426,7 +426,7 @@ class TestSearchGeoLocations:# Mock both the API request and the auth system to bypass decorator issueswith patch('meta_ads_mcp.core.targeting.make_api_request', new_callable=AsyncMock) as mock_api:- with patch('meta_ads_mcp.core.api.get_current_access_token') as mock_auth:+ with patch('meta_ads_mcp.core.auth.get_current_access_token') as mock_auth:mock_auth.return_value = "test_token"mock_api.return_value = mock_response