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.

39 lines
1.7 KiB

  1. # Copyright 2018 Therp BV <https://therp.nl>.
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  3. from . import common
  4. from ..tablib import Tab
  5. class TestTab(common.TestCommon):
  6. def test_create_page(self):
  7. self.assertTrue(bool(self.tab_board))
  8. tab_obj = Tab(self.tab_board)
  9. page = tab_obj.create_page()
  10. # And we should have a field for (amongst others) selection_type_id.
  11. field = page.xpath('//field[@name="type_selection_id"]')
  12. self.assertTrue(field, 'Field selection_type_id not in page.')
  13. def test_visibility(self):
  14. """Tab positions should be shown for functionaries, but not others."""
  15. self.assertTrue(bool(self.tab_positions))
  16. self.assertTrue(bool(self.partner_important_person))
  17. self.assertTrue(bool(self.partner_common_person))
  18. tab_obj = Tab(self.tab_positions)
  19. self.assertTrue(
  20. tab_obj.compute_visibility(self.partner_important_person),
  21. 'Positions tab should be visible for functionary.')
  22. self.assertFalse(
  23. tab_obj.compute_visibility(self.partner_common_person),
  24. 'Positions tab should not be visible for non-functionary.')
  25. # Tab for departments should only be visible for main partner
  26. self.assertTrue(bool(self.tab_departments))
  27. self.assertTrue(bool(self.partner_big_company))
  28. tab_obj = Tab(self.tab_departments)
  29. self.assertTrue(
  30. tab_obj.compute_visibility(self.env.ref('base.main_partner')),
  31. 'Department tab should be visible for main partner.')
  32. self.assertFalse(
  33. tab_obj.compute_visibility(self.partner_big_company),
  34. 'Department tab should not be visible for other partners.')