Skip to content

Commit

Permalink
Add test for optional args
Browse files Browse the repository at this point in the history
  • Loading branch information
sc68cal committed Feb 29, 2012
1 parent 20c342c commit 2496b90
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion redis/test.py
Expand Up @@ -25,9 +25,17 @@ def test():
self.app({'PATH_INFO':'/', 'REQUEST_METHOD':'GET'}, lambda x, y: None)

@self.app.get('/2')
def test(**kw):
def test_kw(**kw):
self.assertFalse('rdb' in kw)
self.app({'PATH_INFO':'/2', 'REQUEST_METHOD':'GET'}, lambda x, y: None)

def test_optional_args(self):
self.plugin = self.app.install(redis_plugin.Plugin(database=1))

@self.app.get('/db/1')
def test_db_arg(rdb):
self.assertTrue(rdb.connection_pool.connection_kwargs['db'] == 1)
self.app({'PATH_INFO':'/db/1', 'REQUEST_METHOD':'GET'}, lambda x,y: None)

if __name__ == '__main__':
unittest.main()

0 comments on commit 2496b90

Please sign in to comment.