[test] Make sure that newcube command test produces expected files

authorDenis Laxalde <denis.laxalde@logilab.fr>
changeseta1ccb934f361
branchdefault
phasedraft
hiddenyes
parent revision#2dafcdd19c99 pep8 bits
child revision<not specified>
files modified by this revision
cubicweb/devtools/test/unittest_devctl.py
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1453364644 -3600
# Thu Jan 21 09:24:04 2016 +0100
# Node ID a1ccb934f361deb67a6f677687f301a5c659be70
# Parent 2dafcdd19c9918f6d0bde86b6afdcaf07c1722b3
[test] Make sure that newcube command test produces expected files

diff --git a/cubicweb/devtools/test/unittest_devctl.py b/cubicweb/devtools/test/unittest_devctl.py
@@ -15,10 +15,12 @@
1  #
2  # You should have received a copy of the GNU Lesser General Public License along
3  # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
4  """unit tests for cubicweb-ctl commands from devtools"""
5 
6 +import os
7 +import os.path as osp
8  import sys
9  import tempfile
10  import shutil
11  from subprocess import Popen, PIPE, STDOUT
12  from unittest import TestCase
@@ -26,16 +28,22 @@
13 
14  class CubicWebCtlTC(TestCase):
15      """test case for devtools commands"""
16 
17      def test_newcube(self):
18 +        expected = ['i18n', 'hooks.py', 'setup.py', 'views.py', 'test',
19 +                    'migration', 'entities.py', 'MANIFEST.in', 'schema.py',
20 +                    'cubicweb-foo.spec', '__init__.py', 'debian', 'data',
21 +                    '__pkginfo__.py', 'README']
22          tmpdir = tempfile.mkdtemp(prefix="temp-cwctl-newcube")
23          try:
24              cmd = [sys.executable, '-m', 'cubicweb', 'newcube',
25                     '--directory', tmpdir, 'foo']
26              proc = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
27              stdout, _ = proc.communicate(b'short_desc\n')
28 +            self.assertEqual(sorted(os.listdir(osp.join(tmpdir, 'foo'))),
29 +                             sorted(expected))
30          finally:
31              shutil.rmtree(tmpdir, ignore_errors=True)
32          self.assertEqual(proc.returncode, 0, msg=stdout)
33 
34