29 lines
900 B
Python
29 lines
900 B
Python
"""Cron handler smoke tests."""
|
|
|
|
from datetime import date
|
|
|
|
from odoo.tests import tagged
|
|
from odoo.tests.common import TransactionCase
|
|
|
|
|
|
@tagged('post_install', '-at_install')
|
|
class TestFusionAssetsCron(TransactionCase):
|
|
|
|
def setUp(self):
|
|
super().setUp()
|
|
self.cron = self.env['fusion.assets.cron']
|
|
self.asset = self.env['fusion.asset'].create({
|
|
'name': 'Cron Test', 'cost': 4000,
|
|
'acquisition_date': date(2026, 1, 1),
|
|
'in_service_date': date(2026, 1, 1),
|
|
'method': 'straight_line', 'useful_life_years': 4,
|
|
})
|
|
self.env['fusion.asset.engine'].compute_depreciation_schedule(self.asset)
|
|
self.asset.action_set_running()
|
|
|
|
def test_cron_post_due_depreciation_runs(self):
|
|
self.cron._cron_post_due_depreciation()
|
|
|
|
def test_cron_anomaly_scan_runs(self):
|
|
self.cron._cron_anomaly_scan()
|