|
| 1 | +from plone.dexterity.fti import DexterityFTI |
| 2 | + |
| 3 | +import pytest |
| 4 | + |
| 5 | + |
| 6 | +@pytest.fixture(scope="class") |
| 7 | +def portal(portal_class): |
| 8 | + yield portal_class |
| 9 | + |
| 10 | + |
| 11 | +class TestCTPloneSite: |
| 12 | + portal_type: str = "Plone Site" |
| 13 | + |
| 14 | + @pytest.fixture(autouse=True) |
| 15 | + def _setup(self, portal, get_fti): |
| 16 | + self.portal = portal |
| 17 | + self.fti: DexterityFTI = get_fti(self.portal_type) |
| 18 | + |
| 19 | + @pytest.mark.parametrize( |
| 20 | + "attr,expected", |
| 21 | + [ |
| 22 | + ("title", "Plone Site"), |
| 23 | + ("klass", "Products.CMFPlone.Portal.PloneSite"), |
| 24 | + ("global_allow", False), |
| 25 | + ], |
| 26 | + ) |
| 27 | + def test_fti(self, attr: str, expected): |
| 28 | + """Test FTI values.""" |
| 29 | + fti = self.fti |
| 30 | + |
| 31 | + assert isinstance(fti, DexterityFTI) |
| 32 | + assert getattr(fti, attr) == expected |
| 33 | + |
| 34 | + @pytest.mark.parametrize( |
| 35 | + "name,expected", |
| 36 | + [ |
| 37 | + ("plone.dublincore", True), |
| 38 | + ("plone.richtext", False), |
| 39 | + ("plone.relateditems", True), |
| 40 | + ("plone.locking", True), |
| 41 | + ("plone.excludefromnavigation", True), |
| 42 | + ("plone.tableofcontents", True), |
| 43 | + ("voltolighttheme.header", True), |
| 44 | + ("voltolighttheme.footer", True), |
| 45 | + ("kitconcept.footer", True), |
| 46 | + ("kitconcept.sticky_menu", True), |
| 47 | + ("plonegovbr.socialmedia.settings", True), |
| 48 | + ("volto.blocks", True), |
| 49 | + ("volto.preview_image", True), |
| 50 | + ], |
| 51 | + ) |
| 52 | + def test_behavior(self, name: str, expected: bool): |
| 53 | + """Test behavior is present or not.""" |
| 54 | + fti = self.fti |
| 55 | + behaviors = fti.behaviors |
| 56 | + assert (name in behaviors) is expected |
0 commit comments