test_utm.py 1.2 KB

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo.addons.utm.tests.common import TestUTMCommon
  4. from odoo.exceptions import UserError
  5. from odoo.tests.common import tagged, users
  6. @tagged('post_install', '-at_install', 'utm_consistency')
  7. class TestUTMConsistencyHrRecruitment(TestUTMCommon):
  8. @users('__system__')
  9. def test_utm_consistency(self):
  10. hr_recruitment_source = self.env['hr.recruitment.source'].create({
  11. 'name': 'Recruitment Source'
  12. })
  13. # the source is automatically created when creating a recruitment source
  14. utm_source = hr_recruitment_source.source_id
  15. with self.assertRaises(UserError):
  16. # can't unlink the source as it's used by a mailing.mailing as its source
  17. # unlinking the source would break all the mailing statistics
  18. utm_source.unlink()
  19. # you are not supposed to delete the 'utm_campaign_job' record as it is hardcoded in
  20. # the creation of the alias of the recruitment source
  21. with self.assertRaises(UserError):
  22. self.env.ref('hr_recruitment.utm_campaign_job').unlink()