Files
Odoo-Modules/fusion_accounting_ai/tests/test_data_adapters.py
2026-04-18 22:59:47 -04:00

28 lines
1.1 KiB
Python

from odoo.tests.common import TransactionCase, tagged
from odoo.addons.fusion_accounting_ai.services.data_adapters.base import (
DataAdapter, AdapterMode,
)
@tagged('post_install', '-at_install')
class TestDataAdapterBase(TransactionCase):
"""Verify the data adapter base class chooses the correct backend."""
def test_adapter_mode_pure_community(self):
"""With no fusion native and no Enterprise, adapter selects COMMUNITY."""
adapter = DataAdapter(self.env)
mode = adapter._select_mode(
fusion_native_model='fusion.bank.rec.widget',
enterprise_module='account_accountant',
)
self.assertIn(mode, (AdapterMode.FUSION, AdapterMode.ENTERPRISE, AdapterMode.COMMUNITY))
def test_adapter_falls_back_when_fusion_model_missing(self):
"""Adapter must not error when the fusion native model isn't loaded."""
adapter = DataAdapter(self.env)
mode = adapter._select_mode(
fusion_native_model='fusion.never.exists',
enterprise_module='also_does_not_exist',
)
self.assertEqual(mode, AdapterMode.COMMUNITY)