Skip to content

Commit 553b6da

Browse files
Merge pull request #4 from TheSaintSimon/permissions
git tests
2 parents 3b7ec34 + c2c6ea6 commit 553b6da

6 files changed

Lines changed: 53 additions & 5 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ reports/
3939
!.gitkeep
4040
!.travis.yml
4141
!src/collective
42+
pyvenv.cfg

buildout.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[buildout]
22

33
extends =
4-
test_plone52.cfg
4+
test_plone60.cfg

constraints_plone60.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-c https://dist.plone.org/release/6.0-latest/constraints.txt
2+
3+
tox==4.3.5
4+
isort>=5
5+
black==22.8.0
6+
flake8==5.0.4

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
-c constraints_plone52.txt
1+
-c constraints_plone60.txt
22
setuptools
33
zc.buildout

src/collective/volto/secondarymenu/tests/test_setup.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def setUp(self):
3232
def test_product_installed(self):
3333
"""Test if collective.volto.secondarymenu is installed."""
3434
self.assertTrue(
35-
self.installer.isProductInstalled("collective.volto.secondarymenu")
35+
_is_installed(self.installer, "collective.volto.secondarymenu")
3636
)
3737

3838
def test_browserlayer(self):
@@ -59,13 +59,13 @@ def setUp(self):
5959
self.installer = api.portal.get_tool("portal_quickinstaller")
6060
roles_before = api.user.get_roles(TEST_USER_ID)
6161
setRoles(self.portal, TEST_USER_ID, ["Manager"])
62-
self.installer.uninstallProducts(["collective.volto.secondarymenu"])
62+
_uninstall(self.installer, "collective.volto.secondarymenu")
6363
setRoles(self.portal, TEST_USER_ID, roles_before)
6464

6565
def test_product_uninstalled(self):
6666
"""Test if collective.volto.secondarymenu is cleanly uninstalled."""
6767
self.assertFalse(
68-
self.installer.isProductInstalled("collective.volto.secondarymenu")
68+
_is_installed(self.installer, "collective.volto.secondarymenu")
6969
)
7070

7171
def test_browserlayer_removed(self):
@@ -78,3 +78,15 @@ def test_browserlayer_removed(self):
7878
self.assertNotIn(
7979
ICollectiveVoltoSecondaryMenuLayer, utils.registered_layers()
8080
)
81+
82+
83+
def _is_installed(installer, product_id):
84+
if hasattr(installer, "is_product_installed"):
85+
return installer.is_product_installed(product_id)
86+
return installer.isProductInstalled(product_id)
87+
88+
89+
def _uninstall(installer, product_id):
90+
if hasattr(installer, "uninstall_product"):
91+
return installer.uninstall_product(product_id)
92+
return installer.uninstallProducts([product_id])

test_plone60.cfg

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[buildout]
2+
3+
extends =
4+
https://raw.githubusercontent.com/collective/buildout.plonetest/master/test-6.0.x.cfg
5+
https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg
6+
base.cfg
7+
8+
update-versions-file = test_plone60.cfg
9+
10+
# Optional release tooling pulls in cmarkgfm -> cffi>=2, which conflicts with
11+
# Plone 6 KGS pins. Skip it for the Plone 6 test buildout.
12+
parts -=
13+
releaser
14+
15+
# Added by buildout at 2026-01-23 14:17:48.491263
16+
build = 1.4.0
17+
coverage = 7.13.1
18+
createcoverage = 1.5
19+
flake8 = 7.3.0
20+
i18ndude = 6.3.0
21+
mccabe = 0.7.0
22+
plone-recipe-codeanalysis = 3.0.1
23+
pycodestyle = 2.14.0
24+
pyflakes = 3.4.0
25+
pyproject-hooks = 1.2.0
26+
27+
# Required by:
28+
# plone-recipe-codeanalysis==3.0.1
29+
check-manifest = 0.51

0 commit comments

Comments
 (0)