Back to index

obnam  1.1
Public Member Functions | Public Attributes
obnamlib.hooks_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_new_filter_hook
def test_adds_callback
def test_removes_callback
def test_calls_callbacks
def test_filter_write_returns_value_of_callbacks
def test_filter_read_returns_value_of_callbacks
def test_add_callbacks_to_filters
def test_remove_callbacks_from_filters

Public Attributes

 hooks
 args
 kwargs

Detailed Description

Definition at line 150 of file hooks_tests.py.


Member Function Documentation

def obnamlib.hooks_tests.HookManagerTests.callback (   self,
  args,
  kwargs 
)

Definition at line 156 of file hooks_tests.py.

00156 
00157     def callback(self, *args, **kwargs):
00158         self.args = args
00159         self.kwargs = kwargs

Here is the caller graph for this function:

Definition at line 152 of file hooks_tests.py.

00152 
00153     def setUp(self):
00154         self.hooks = obnamlib.HookManager()
00155         self.hooks.new('foo')
        

Definition at line 194 of file hooks_tests.py.

00194 
00195     def test_add_callbacks_to_filters(self):
00196         self.hooks.new_filter('bar')
00197         filt = NeverAddsFilter()
00198         self.hooks.add_callback('bar', filt)
00199         self.assertEquals(self.hooks.filters['bar'].callbacks, [filt])

Definition at line 171 of file hooks_tests.py.

00171 
00172     def test_adds_callback(self):
00173         self.hooks.add_callback('foo', self.callback)
00174         self.assertEqual(self.hooks.hooks['foo'].callbacks, [self.callback])

Here is the call graph for this function:

Definition at line 167 of file hooks_tests.py.

00167 
00168     def test_adds_new_filter_hook(self):
00169         self.hooks.new_filter('bar')
00170         self.assert_('bar' in self.hooks.filters)
        

Definition at line 164 of file hooks_tests.py.

00164 
00165     def test_adds_new_hook(self):
00166         self.assert_(self.hooks.hooks.has_key('foo'))
        

Definition at line 180 of file hooks_tests.py.

00180 
00181     def test_calls_callbacks(self):
00182         self.hooks.add_callback('foo', self.callback)
00183         self.hooks.call('foo', 'bar', kwarg='foobar')
00184         self.assertEqual(self.args, ('bar',))
00185         self.assertEqual(self.kwargs, { 'kwarg': 'foobar' })

Here is the call graph for this function:

Definition at line 190 of file hooks_tests.py.

00190 
00191     def test_filter_read_returns_value_of_callbacks(self):
00192         self.hooks.new_filter('bar')
00193         self.assertEquals(self.hooks.filter_read('bar', "\0foo"), "foo")

Definition at line 186 of file hooks_tests.py.

00186 
00187     def test_filter_write_returns_value_of_callbacks(self):
00188         self.hooks.new_filter('bar')
00189         self.assertEquals(self.hooks.filter_write('bar', "foo"), "\0foo")

Definition at line 160 of file hooks_tests.py.

00160 
00161     def test_has_no_tests_initially(self):
00162         hooks = obnamlib.HookManager()
00163         self.assertEqual(hooks.hooks, {})
        

Definition at line 200 of file hooks_tests.py.

00200 
00201     def test_remove_callbacks_from_filters(self):
00202         self.hooks.new_filter('bar')
00203         filt = NeverAddsFilter()
00204         self.hooks.add_callback('bar', filt)
00205         self.hooks.remove_callback('bar', filt)
00206         self.assertEquals(self.hooks.filters['bar'].callbacks, [])

Definition at line 175 of file hooks_tests.py.

00175 
00176     def test_removes_callback(self):
00177         cb_id = self.hooks.add_callback('foo', self.callback)
00178         self.hooks.remove_callback('foo', cb_id)
00179         self.assertEqual(self.hooks.hooks['foo'].callbacks, [])

Here is the call graph for this function:


Member Data Documentation

Definition at line 157 of file hooks_tests.py.

Definition at line 153 of file hooks_tests.py.

Definition at line 158 of file hooks_tests.py.


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