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.

31 lines
950 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. import random
  5. import string
  6. from odoo.tests.common import TransactionCase
  7. MAX_DB_USER_PARAM = 'user.threshold.database'
  8. class Common(TransactionCase):
  9. def _create_test_user(self):
  10. """ Create a user for testing """
  11. user = self.env.ref('base.user_demo').copy()
  12. rand_name = ''.join([
  13. random.choice(string.ascii_letters) for n in xrange(10)
  14. ])
  15. user.write({'login': rand_name})
  16. return user
  17. def _add_user_to_group(self, user):
  18. """ Add a given user Record to the threshold manager group """
  19. th_group = self.env.ref('user_threshold.group_threshold_manager')
  20. system_group = self.env.ref('base.group_system')
  21. user.write({
  22. 'in_group_%s' % th_group.id: True,
  23. 'in_group_%s' % system_group.id: True
  24. })