Skip to content

Commit

Permalink
Some test refactoring. Remove template folder dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
iurisilvio committed Mar 25, 2012
1 parent cd941b7 commit 6bbe9ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
20 changes: 10 additions & 10 deletions test.py
Expand Up @@ -9,24 +9,24 @@

Base = declarative_base()

def accept_only_kwargs(route):
def wrapper(**kwargs):
return route(**kwargs)
return wrapper

class Entity(Base):
__tablename__ = 'entity'
id = Column(Integer, Sequence('id_seq'), primary_key=True)


class AnotherPlugin(object):
name = 'another'
api = 2

def apply(self, callback, route):
import inspect
def wrapper(*args, **kwargs):
return callback(param=1, *args, **kwargs)

return wrapper



class SQLAlchemyPluginTest(unittest.TestCase):

def setUp(self):
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_install_conflicts(self):
self._install_plugin, self.engine)

def test_route_with_view(self):
@self.app.get('/', apply=[bottle.view('index')])
@self.app.get('/', apply=[accept_only_kwargs])
def test(db):
pass

Expand All @@ -88,12 +88,12 @@ def test(db):

def test_view_decorator(self):
@self.app.get('/')
@bottle.view('index')
@accept_only_kwargs
def test(db):
pass

@self.app.get('/2', sqlalchemy=dict(use_kwargs=True))
@bottle.view('index')
@accept_only_kwargs
def test(db):
pass

Expand Down Expand Up @@ -159,7 +159,7 @@ def test_install_other_plugin_after(self):

@self.app.get('/')
def test(db, param):
self.assertIsNotNone(db)
self.assertTrue(db is not None)
self.assertEqual(param, 1)

self._request_path('/')
Expand All @@ -171,7 +171,7 @@ def test_install_other_plugin_before(self):

@app.get('/')
def test(db, param):
self.assertIsNotNone(db)
self.assertTrue(db is not None)
self.assertEqual(param, 1)

self._request_path('/', app=app)
Expand Down
1 change: 0 additions & 1 deletion views/index.tpl

This file was deleted.

0 comments on commit 6bbe9ee

Please sign in to comment.