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.

45 lines
1.7 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. # Copyright 2018 Vauxoo (https://www.vauxoo.com) <info@vauxoo.com>
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo.tests.common import HttpCase
  4. class TestProfiling(HttpCase):
  5. def test_profile_creation(self):
  6. """We are testing the creation of a profile."""
  7. prof_obj = self.env['profiler.profile']
  8. profile = prof_obj.create({'name': 'this_profiler'})
  9. self.assertEqual(0, profile.attachment_count)
  10. profile.enable()
  11. self.assertFalse(self.xmlrpc_common.authenticate(
  12. self.env.cr.dbname, 'this is not a user',
  13. 'this is not a password', {}))
  14. profile.disable()
  15. def test_profile_creation_with_py(self):
  16. """We are testing the creation of a profile. with py index"""
  17. prof_obj = self.env['profiler.profile']
  18. profile = prof_obj.create({
  19. 'name': 'this_profiler',
  20. 'use_py_index': True,
  21. })
  22. self.assertEqual(0, profile.attachment_count)
  23. profile.enable()
  24. self.assertFalse(self.xmlrpc_common.authenticate(
  25. self.env.cr.dbname, 'this is not a user',
  26. 'this is not a password', {}))
  27. profile.disable()
  28. def test_onchange(self):
  29. prof_obj = self.env['profiler.profile']
  30. profile = prof_obj.create({'name': 'this_profiler'})
  31. self.assertFalse(profile.description)
  32. profile.enable_postgresql = True
  33. profile.onchange_enable_postgresql()
  34. self.assertTrue(profile.description)
  35. profile.enable()
  36. self.assertFalse(self.xmlrpc_common.authenticate(
  37. self.env.cr.dbname, 'this is not a user',
  38. 'this is not a password', {}))
  39. profile.disable()