summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-08-09 22:23:37 -0400
committerChris McDonough <chrism@plope.com>2011-08-09 22:23:37 -0400
commitc9c0ccc2179f63fa3c4030e64b6ccbf8c8996e08 (patch)
treefefed800bcccaf85f16549208d67311643a02a9b
parentace57ba6a0443bbe4cb03fb6543243654c97eefa (diff)
downloadpyramid-c9c0ccc2179f63fa3c4030e64b6ccbf8c8996e08.tar.gz
pyramid-c9c0ccc2179f63fa3c4030e64b6ccbf8c8996e08.tar.bz2
pyramid-c9c0ccc2179f63fa3c4030e64b6ccbf8c8996e08.zip
add production.ini tests; assert that production.ini page output does not contain toolbar html
-rw-r--r--pyramid/scaffolds/tests.py43
1 files changed, 25 insertions, 18 deletions
diff --git a/pyramid/scaffolds/tests.py b/pyramid/scaffolds/tests.py
index e36943465..d5fcba67c 100644
--- a/pyramid/scaffolds/tests.py
+++ b/pyramid/scaffolds/tests.py
@@ -30,7 +30,6 @@ class TemplateTest(object):
[os.path.join(self.directory, 'bin', 'python'),
'setup.py', 'develop'])
os.chdir(self.directory)
-
subprocess.check_call(['bin/paster', 'create', '-t', tmpl_name,
'Dingle'])
os.chdir('Dingle')
@@ -38,23 +37,31 @@ class TemplateTest(object):
subprocess.check_call([py, 'setup.py', 'install'])
subprocess.check_call([py, 'setup.py', 'test'])
paster = os.path.join(self.directory, 'bin', 'paster')
- proc = subprocess.Popen([paster, 'serve', 'development.ini'])
- try:
- time.sleep(5)
- proc.poll()
- if proc.returncode is not None:
- raise RuntimeError('didnt start')
- conn = httplib.HTTPConnection('localhost:6543')
- conn.request('GET', '/')
- resp = conn.getresponse()
- assert(resp.status == 200)
- finally:
- if hasattr(proc, 'terminate'):
- # 2.6+
- proc.terminate()
- else:
- # 2.5
- os.kill(proc.pid, signal.SIGTERM)
+ for ininame, hastoolbar in (('development.ini', True),
+ ('production.ini', False)):
+ proc = subprocess.Popen([paster, 'serve', ininame])
+ try:
+ time.sleep(5)
+ proc.poll()
+ if proc.returncode is not None:
+ raise RuntimeError('%s didnt start' % ininame)
+ conn = httplib.HTTPConnection('localhost:6543')
+ conn.request('GET', '/')
+ resp = conn.getresponse()
+ assert resp.status == 200, ininame
+ data = resp.read()
+ toolbarchunk = '<div id="flDebug"'
+ if hastoolbar:
+ assert toolbarchunk in data, ininame
+ else:
+ assert not toolbarchunk in data, ininame
+ finally:
+ if hasattr(proc, 'terminate'):
+ # 2.6+
+ proc.terminate()
+ else:
+ # 2.5
+ os.kill(proc.pid, signal.SIGTERM)
finally:
shutil.rmtree(self.directory)
os.chdir(self.old_cwd)