feat(fusion_accounting_ai): add DataAdapter base + registry
Made-with: Cursor
This commit is contained in:
27
fusion_accounting_ai/tests/test_data_adapters.py
Normal file
27
fusion_accounting_ai/tests/test_data_adapters.py
Normal file
@@ -0,0 +1,27 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user