@@ -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 ])
0 commit comments