Back to index

python-cliapp  1.20120630
Public Member Functions | Public Attributes
cliapp.hookmgr_tests.HookManagerTests Class Reference

List of all members.

Public Member Functions

def setUp
def callback
def test_has_no_tests_initially
def test_adds_new_hook
def test_adds_callback
def test_removes_callback
def test_calls_callbacks
def test_call_returns_value_of_callbacks

Public Attributes

 hooks
 args
 kwargs

Detailed Description

Definition at line 23 of file hookmgr_tests.py.


Member Function Documentation

def cliapp.hookmgr_tests.HookManagerTests.callback (   self,
  args,
  kwargs 
)

Definition at line 29 of file hookmgr_tests.py.

00029 
00030     def callback(self, *args, **kwargs):
00031         self.args = args
00032         self.kwargs = kwargs

Here is the caller graph for this function:

Definition at line 25 of file hookmgr_tests.py.

00025 
00026     def setUp(self):
00027         self.hooks = HookManager()
00028         self.hooks.new('foo', FilterHook())
        

Definition at line 40 of file hookmgr_tests.py.

00040 
00041     def test_adds_callback(self):
00042         self.hooks.add_callback('foo', self.callback)
00043         self.assertEqual(self.hooks.hooks['foo'].callbacks, [self.callback])

Here is the call graph for this function:

Definition at line 37 of file hookmgr_tests.py.

00037 
00038     def test_adds_new_hook(self):
00039         self.assert_(self.hooks.hooks.has_key('foo'))
        

Definition at line 55 of file hookmgr_tests.py.

00055 
00056     def test_call_returns_value_of_callbacks(self):
00057         self.hooks.new('bar', FilterHook())
00058         self.hooks.add_callback('bar', lambda data: data + 1)
00059         self.assertEqual(self.hooks.call('bar', 1), 2)
00060 

Definition at line 49 of file hookmgr_tests.py.

00049 
00050     def test_calls_callbacks(self):
00051         self.hooks.add_callback('foo', self.callback)
00052         self.hooks.call('foo', 'bar', kwarg='foobar')
00053         self.assertEqual(self.args, ('bar',))
00054         self.assertEqual(self.kwargs, { 'kwarg': 'foobar' })

Here is the call graph for this function:

Definition at line 33 of file hookmgr_tests.py.

00033 
00034     def test_has_no_tests_initially(self):
00035         hooks = HookManager()
00036         self.assertEqual(hooks.hooks, {})
        

Definition at line 44 of file hookmgr_tests.py.

00044 
00045     def test_removes_callback(self):
00046         cb_id = self.hooks.add_callback('foo', self.callback)
00047         self.hooks.remove_callback('foo', cb_id)
00048         self.assertEqual(self.hooks.hooks['foo'].callbacks, [])

Here is the call graph for this function:


Member Data Documentation

Definition at line 30 of file hookmgr_tests.py.

Definition at line 26 of file hookmgr_tests.py.

Definition at line 31 of file hookmgr_tests.py.


The documentation for this class was generated from the following file: