-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
99 lines (88 loc) · 4.36 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# -*- coding: utf-8 -*-
import unittest2 as unittest
import os
import tempfile
import shutil
from scripttest import TestFileEnvironment
class BaseTemplateTest(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree,
self.tempdir)
# docs httpcripttest//pythonpaste.org/scripttest/
self.env = TestFileEnvironment(
os.path.join(self.tempdir,
'test-output'),
ignore_hidden=False,
)
def create_template(self):
"""Run mr.bob to create your template."""
options = {
'dir': os.path.join(os.path.dirname(__file__)),
'template': self.template,
'project': self.project,
}
return self.env.run(
'%(dir)s/bin/mrbob -O %(project)s --config '
'%(dir)s/test_answers.ini %(dir)s/bobtemplates/%(template)s'
% options)
class PloneTemplateTest(BaseTemplateTest):
"""Tests for the `plone` template."""
template = 'plone'
project = 'collective.foo'
def test_plone_template(self):
"""Test the `plone` template.
Generate a project from a template and test which files were created.
"""
result = self.create_template()
self.assertItemsEqual(
result.files_created.keys(),
['collective.foo',
'collective.foo/src/collective/foo/profiles/uninstall',
'collective.foo/src/collective/foo/tests/test_setup.py',
'collective.foo/.travis.yml',
'collective.foo/src/collective/foo/profile.py',
'collective.foo/src/collective/foo/locales',
'collective.foo/docs',
'collective.foo/src/collective/foo/tests',
'collective.foo/src/collective/foo/Extensions',
'collective.foo/src/collective/foo/profiles',
'collective.foo/src/collective/foo/profiles/testing/properties.xml',
'collective.foo/src/collective/foo/Extensions/__init__.py',
'collective.foo/src',
'collective.foo/src/collective/foo/__init__.py',
'collective.foo/src/collective/foo/browser',
'collective.foo/README.rst',
'collective.foo/src/collective/foo/profiles/default',
'collective.foo/src/collective/foo/browser/static/.gitkeep',
'collective.foo/src/collective/foo/testing.zcml',
'collective.foo/src/collective/foo/profiles/testing',
'collective.foo/src/collective',
'collective.foo/src/collective/foo/Extensions/install.py',
'collective.foo/buildout.cfg',
'collective.foo/src/collective/foo/setuphandlers.py',
'collective.foo/src/collective/foo/profiles/uninstall/browserlayer.xml',
'collective.foo/src/collective/__init__.py',
'collective.foo/src/collective/foo/tests/__init__.py',
'collective.foo/docs/LICENSE.rst',
'collective.foo/src/collective/foo/tests/robot/test_example.robot',
'collective.foo/src/collective/foo/profiles/default/browserlayer.xml',
'collective.foo/src/collective/foo/profiles/testing/collective.foo.txt',
'collective.foo/src/collective/foo/tests/robot',
'collective.foo/src/collective/foo/locales/collective.foo.pot',
'collective.foo/src/collective/foo/browser/configure.zcml',
'collective.foo/src/collective/foo/tests/test_robot.py',
'collective.foo/setup.py',
'collective.foo/CHANGES.rst',
'collective.foo/src/collective/foo',
'collective.foo/src/collective/foo/interfaces.py',
'collective.foo/src/collective/foo/browser/static',
'collective.foo/src/collective/foo/profiles/default/metadata.xml',
'collective.foo/MANIFEST.in',
'collective.foo/src/collective/foo/profiles/testing/metadata.xml',
'collective.foo/src/collective/foo/configure.zcml',
'collective.foo/src/collective/foo/testing.py',
'collective.foo/.gitignore',
'collective.foo/src/collective/foo/browser/__init__.py',
'collective.foo/Makefile']
)