Skip to content

Commit

Permalink
Exercíco 27: Habilita comportamentos na raiz do portal
Browse files Browse the repository at this point in the history
  • Loading branch information
samoel-silva committed Sep 17, 2024
1 parent 99805a8 commit 783887d
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/src/portal/governo/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<version>1001</version>
<version>1002</version>
<dependencies>
<dependency>profile-plone.volto:default</dependency>
</dependencies>
Expand Down
16 changes: 16 additions & 0 deletions backend/src/portal/governo/profiles/default/types/Plone_Site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
meta_type="Dexterity FTI"
name="Plone Site"
i18n:domain="plone"
>
<!-- Enabled behaviors -->
<property name="behaviors"
purge="false"
>
<element value="portal.governo.behavior.contato" />
<element value="portal.governo.behavior.endereco" />
</property>


</object>
11 changes: 11 additions & 0 deletions backend/src/portal/governo/upgrades/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@
/>
</genericsetup:upgradeSteps>

<genericsetup:upgradeSteps
profile="portal.governo:default"
source="1001"
destination="1002"
>
<genericsetup:upgradeDepends
title="Altera comportamentos do tipo Plone Site"
import_steps="typeinfo"
/>
</genericsetup:upgradeSteps>

</configure>
20 changes: 20 additions & 0 deletions backend/tests/content/test_ct_plone_site.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pytest


CONTENT_TYPE = "Plone Site"


class TestPloneSite:
@pytest.fixture(autouse=True)
def _setup(self, portal):
self.portal = portal

@pytest.mark.parametrize(
"behavior",
[
"portal.governo.behavior.contato",
"portal.governo.behavior.endereco",
],
)
def test_has_behavior(self, get_behaviors, behavior):
assert behavior in get_behaviors(CONTENT_TYPE)
2 changes: 1 addition & 1 deletion backend/tests/setup/test_setup_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def test_browserlayer(self, browser_layers):

def test_latest_version(self, profile_last_version):
"""Test latest version of default profile."""
assert profile_last_version(f"{PACKAGE_NAME}:default") == "1001"
assert profile_last_version(f"{PACKAGE_NAME}:default") == "1002"

0 comments on commit 783887d

Please sign in to comment.