You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
913 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 LasLabs Inc.
  3. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
  4. from odoo.tests.common import TransactionCase
  5. class BusSetup(TransactionCase):
  6. def setUp(self):
  7. super(BusSetup, self).setUp()
  8. self.u_admin = self.env.ref('base.user_root')
  9. self.p_admin = self.u_admin.partner_id
  10. self.u_demo = self.env.ref('base.user_demo')
  11. self.p_demo = self.u_demo.partner_id
  12. self.pres_admin = self._get_bus_presence(self.u_admin)
  13. self.pres_demo = self._get_bus_presence(self.u_demo)
  14. # AWAY_TIMER = 55 seconds
  15. # DISCONNECTION_TIMER = 1800 seconds (30 minutes)
  16. def _get_bus_presence(self, user):
  17. pres = self.env['bus.presence'].search([('user_id', '=', user.id)])
  18. if not pres:
  19. pres = self.env['bus.presence'].create({'user_id': user.id})
  20. return pres