cubicweb/test/unittest_cwctl.py
branch3.25
changeset 12120 707139a9eb00
parent 12053 c3c9f2e1424c
child 12121 86ec847835cd
--- a/cubicweb/test/unittest_cwctl.py	Tue Mar 28 17:12:47 2017 +0200
+++ b/cubicweb/test/unittest_cwctl.py	Wed Mar 29 11:14:53 2017 +0200
@@ -23,14 +23,21 @@
 
 from six import PY2
 
+from mock import patch
+
 from cubicweb.cwconfig import CubicWebConfiguration
 from cubicweb.cwctl import ListCommand
 from cubicweb.devtools.testlib import CubicWebTC
 from cubicweb.server.migractions import ServerMigrationHelper
 
+import unittest_cwconfig
+
 
 class CubicWebCtlTC(unittest.TestCase):
 
+    setUpClass = unittest_cwconfig.CubicWebConfigurationTC.setUpClass
+    tearDownClass = unittest_cwconfig.CubicWebConfigurationTC.tearDownClass
+
     def setUp(self):
         self.stream = BytesIO() if PY2 else StringIO()
         sys.stdout = self.stream
@@ -38,8 +45,12 @@
     def tearDown(self):
         sys.stdout = sys.__stdout__
 
-    def test_list(self):
+    @patch('pkg_resources.iter_entry_points', side_effect=unittest_cwconfig.iter_entry_points)
+    def test_list(self, mock_iter_entry_points):
         ListCommand(None).run([])
+        self.assertNotIn('cubicweb_', self.stream.getvalue())
+        mock_iter_entry_points.assert_called_once_with(
+            group='cubicweb.cubes', name=None)
 
     def test_list_configurations(self):
         ListCommand(None).run(['configurations'])