Skip to content

Commit

Permalink
[svn] Added kid default render test and all tests now passing for ren…
Browse files Browse the repository at this point in the history
…dering.

--HG--
branch : trunk
  • Loading branch information
bbangert committed Jun 4, 2006
1 parent 59314ef commit 20284b0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 29 deletions.
5 changes: 4 additions & 1 deletion tests/test_webapps/test_files/controller_sample.py
Expand Up @@ -23,9 +23,12 @@ def myself(self):

def myparams(self):
return Response(str(params))

def testdefault(self):
return render_response('testkid')

def test_extra_engine(self):
return render_response('kid', 'testkids')
return render_response('kid', 'testkid')

def test_template_caching(self):
return render_response('/test_myghty.myt', cache_expire='never')
@@ -1,50 +1,50 @@
from projectname.tests import *

class TestTest1Controller(TestController):
class TestSampleController(TestController):
def test_root_index(self):
response = self.app.get(url_for(controller='/'))
assert 'Welcome' in response
# Test response...

def test_index(self):
response = self.app.get(url_for(controller='/test1'))
response = self.app.get(url_for(controller='/sample'))
assert 'basic index page' in response

def test_session(self):
response = self.app.get(url_for(controller='/test1', action='session_increment'))
response = self.app.get(url_for(controller='/sample', action='session_increment'))
assert response.session.has_key('counter')
assert response.session['counter'] == 0

response = self.app.get(url_for(controller='/test1', action='session_increment'))
response = self.app.get(url_for(controller='/sample', action='session_increment'))
assert response.session['counter'] == 1
assert 'session incrementer' in response

def test_global(self):
response = self.app.get(url_for(controller='/test1', action='globalup'))
response = self.app.get(url_for(controller='/sample', action='globalup'))
assert 'Hello' in response

def test_global_persistence(self):
response = self.app.get(url_for(controller='/test1', action='global_store'))
response = self.app.get(url_for(controller='/sample', action='global_store'))
assert '0' in response

response = self.app.get(url_for(controller='/test1', action='global_store', id=2))
response = self.app.get(url_for(controller='/sample', action='global_store', id=2))
assert '2' in response

response = self.app.get(url_for(controller='/test1', action='global_store'))
response = self.app.get(url_for(controller='/sample', action='global_store'))
assert '2' in response

response = self.app.get(url_for(controller='/test1', action='global_store', id=3))
response = self.app.get(url_for(controller='/sample', action='global_store', id=3))
assert '5' in response

response = self.app.get(url_for(controller='/test1', action='global_store'))
response = self.app.get(url_for(controller='/sample', action='global_store'))
assert '5' in response

def test_helper_urlfor(self):
response = self.app.get(url_for(controller='/test1', action='myself'))
assert '/test1/myself' in response
response = self.app.get(url_for(controller='/sample', action='myself'))
assert '/sample/myself' in response

def test_params(self):
response = self.app.get(url_for(controller='/test1', action='myparams', extra='something', data=4))
response = self.app.get(url_for(controller='/sample', action='myparams', extra='something', data=4))
assert 'extra' in response
assert 'something' in response
assert 'data' in response
@@ -1,16 +1,16 @@
from projectname.tests import *

class TestTest2Controller(TestController):
class TestSample2Controller(TestController):
def test_session(self):
response = self.app.get(url_for(controller='/test1', action='session_increment'))
response = self.app.get(url_for(controller='/sample', action='session_increment'))
assert response.session.has_key('counter')
assert response.session['counter'] == 0

response = self.app.get(url_for(controller='/test1', action='session_increment'))
response = self.app.get(url_for(controller='/sample', action='session_increment'))
assert response.session['counter'] == 1
assert 'session incrementer' in response

def test_kid_default(self):
response = self.app.get(url_for(controller='/test1', action='testdefault'))
response = self.app.get(url_for(controller='/sample', action='testdefault'))
assert 'Hello from Kid' in response

20 changes: 9 additions & 11 deletions tests/test_webapps/test_make_project.py
Expand Up @@ -81,9 +81,9 @@ def paster_create():
+ projenv.base_path)

def make_controller():
res = projenv.run(_get_script_name('paster')+' controller test1')
assert os.path.join('projectname','controllers','test1.py') in res.files_created
assert os.path.join('projectname','tests','functional','test_test1.py') in res.files_created
res = projenv.run(_get_script_name('paster')+' controller sample')
assert os.path.join('projectname','controllers','sample.py') in res.files_created
assert os.path.join('projectname','tests','functional','test_sample.py') in res.files_created
res = projenv.run(_get_script_name('svn')+' status')
# Make sure all files are added to the repository:
assert '?' not in res.stdout
Expand All @@ -96,26 +96,24 @@ def do_pytest():
cwd=os.path.join(testenv.cwd, 'ProjectName').replace('\\','/'))

def do_test_known():
projenv.writefile('projectname/controllers/test1.py',
frompath='controller_test1.py')
projenv.writefile('projectname/controllers/sample.py',
frompath='controller_sample.py')
projenv.writefile('projectname/lib/app_globals.py',
frompath='app_globals.py')
projenv.writefile('projectname/tests/functional/test_test1.py',
frompath='functional_test_controller_test1.py')
projenv.writefile('projectname/tests/functional/test_sample.py',
frompath='functional_sample_controller_sample1.py')
res = projenv.run(_get_script_name('nosetests')+' projectname/tests',
expect_stderr=True,
cwd=os.path.join(testenv.cwd, 'ProjectName').replace('\\','/'))

def do_kid_default():
projenv.writefile('projectname/controllers/test1.py',
frompath='controller_test2.py')
projenv.writefile('projectname/kidtemplates/testkid.kid',
frompath='testkid.kid')
projenv.writefile('projectname/kidtemplates/__init__.py')
projenv.writefile('projectname/config/middleware.py',
frompath='middleware_def_engine.py')
projenv.writefile('projectname/tests/functional/test_test2.py',
frompath='functional_test_controller_test2.py')
projenv.writefile('projectname/tests/functional/test_sample2.py',
frompath='functional_sample_controller_sample2.py')
res = projenv.run(_get_script_name('nosetests')+' projectname/tests',
expect_stderr=True,
cwd=os.path.join(testenv.cwd, 'ProjectName').replace('\\','/'))
Expand Down

0 comments on commit 20284b0

Please sign in to comment.