mirror of
https://github.com/bringout/oca-ocb-vertical-industry.git
synced 2026-04-22 23:12:03 +02:00
19.0 vanilla
This commit is contained in:
parent
4607ccbd2e
commit
825ff6514e
487 changed files with 184979 additions and 195262 deletions
|
|
@ -8,7 +8,7 @@ from odoo.addons.lunch.tests.common import TestsCommon
|
|||
class TestAlarm(TestsCommon):
|
||||
@common.users('cle-lunch-manager')
|
||||
def test_cron_sync_create(self):
|
||||
cron_ny = self.alert_ny.cron_id
|
||||
cron_ny = self.alert_ny.cron_id.sudo()
|
||||
self.assertTrue(cron_ny.active)
|
||||
self.assertEqual(cron_ny.name, "Lunch: alert chat notification (New York UTC-5)")
|
||||
self.assertEqual(
|
||||
|
|
@ -16,12 +16,12 @@ class TestAlarm(TestsCommon):
|
|||
["env['lunch.alert'].browse([%i])._notify_chat()" % self.alert_ny.id])
|
||||
self.assertEqual(cron_ny.nextcall, datetime(2021, 1, 29, 15, 0)) # New-york is UTC-5
|
||||
|
||||
tokyo_cron = self.alert_tokyo.cron_id
|
||||
tokyo_cron = self.alert_tokyo.cron_id.sudo()
|
||||
self.assertEqual(tokyo_cron.nextcall, datetime(2021, 1, 29, 23, 0)) # Tokyo is UTC+9 but the cron is posponed
|
||||
|
||||
@common.users('cle-lunch-manager')
|
||||
def test_cron_sync_active(self):
|
||||
cron_ny = self.alert_ny.cron_id
|
||||
cron_ny = self.alert_ny.cron_id.sudo()
|
||||
|
||||
self.alert_ny.active = False
|
||||
self.assertFalse(cron_ny.active)
|
||||
|
|
@ -43,15 +43,15 @@ class TestAlarm(TestsCommon):
|
|||
|
||||
@common.users('cle-lunch-manager')
|
||||
def test_cron_sync_nextcall(self):
|
||||
cron_ny = self.alert_ny.cron_id
|
||||
cron_ny = self.alert_ny.cron_id.sudo()
|
||||
old_nextcall = cron_ny.nextcall
|
||||
|
||||
self.alert_ny.notification_time -= 5
|
||||
self.assertEqual(cron_ny.nextcall, old_nextcall - timedelta(hours=5) + timedelta(days=1))
|
||||
|
||||
# Simulate cron execution
|
||||
cron_ny.sudo().lastcall = old_nextcall - timedelta(hours=5)
|
||||
cron_ny.sudo().nextcall += timedelta(days=1)
|
||||
cron_ny.lastcall = old_nextcall - timedelta(hours=5)
|
||||
cron_ny.nextcall += timedelta(days=1)
|
||||
|
||||
self.alert_ny.notification_time += 7
|
||||
self.assertEqual(cron_ny.nextcall, old_nextcall + timedelta(days=1, hours=2))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue