Back to index

obnam  1.1
Public Member Functions | Public Attributes
obnamlib.hooks_tests.HookTests Class Reference

List of all members.

Public Member Functions

def setUp
def callback
def callback2
def test_has_no_callbacks_by_default
def test_adds_callback
def test_adds_callback_only_once
def test_adds_two_callbacks
def test_adds_callbacks_in_reverse_order
def test_calls_callback
def test_removes_callback

Public Attributes

 hook
 args
 kwargs
 args2
 kwargs2

Detailed Description

Definition at line 23 of file hooks_tests.py.


Member Function Documentation

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

Definition at line 28 of file hooks_tests.py.

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

Here is the caller graph for this function:

def obnamlib.hooks_tests.HookTests.callback2 (   self,
  args,
  kwargs 
)

Definition at line 32 of file hooks_tests.py.

00032 
00033     def callback2(self, *args, **kwargs):
00034         self.args2 = args
00035         self.kwargs2 = kwargs

Here is the caller graph for this function:

Definition at line 25 of file hooks_tests.py.

00025 
00026     def setUp(self):
00027         self.hook = obnamlib.Hook()
        

Definition at line 39 of file hooks_tests.py.

00039 
00040     def test_adds_callback(self):
00041         self.hook.add_callback(self.callback)
00042         self.assertEqual(self.hook.callbacks, [self.callback])
        

Here is the call graph for this function:

Definition at line 43 of file hooks_tests.py.

00043 
00044     def test_adds_callback_only_once(self):
00045         self.hook.add_callback(self.callback)
00046         self.hook.add_callback(self.callback)
00047         self.assertEqual(self.hook.callbacks, [self.callback])
        

Here is the call graph for this function:

Definition at line 55 of file hooks_tests.py.

00055 
00056     def test_adds_callbacks_in_reverse_order(self):
00057         id1 = self.hook.add_callback(self.callback)
00058         id2 = self.hook.add_callback(self.callback2, 
00059                                      obnamlib.Hook.DEFAULT_PRIORITY - 1)
00060         self.assertEqual(self.hook.callbacks, [self.callback2, self.callback])
00061         self.assertNotEqual(id1, id2)

Here is the call graph for this function:

Definition at line 48 of file hooks_tests.py.

00048 
00049     def test_adds_two_callbacks(self):
00050         id1 = self.hook.add_callback(self.callback)
00051         id2 = self.hook.add_callback(self.callback2, 
00052                                      obnamlib.Hook.DEFAULT_PRIORITY + 1)
00053         self.assertEqual(self.hook.callbacks, [self.callback, self.callback2])
00054         self.assertNotEqual(id1, id2)
        

Here is the call graph for this function:

Definition at line 62 of file hooks_tests.py.

00062 
00063     def test_calls_callback(self):
00064         self.hook.add_callback(self.callback)
00065         self.hook.call_callbacks('bar', kwarg='foobar')
00066         self.assertEqual(self.args, ('bar',))
00067         self.assertEqual(self.kwargs, { 'kwarg': 'foobar' })

Here is the call graph for this function:

Definition at line 36 of file hooks_tests.py.

00036 
00037     def test_has_no_callbacks_by_default(self):
00038         self.assertEqual(self.hook.callbacks, [])
        

Definition at line 68 of file hooks_tests.py.

00068 
00069     def test_removes_callback(self):
00070         cb_id = self.hook.add_callback(self.callback)
00071         self.hook.remove_callback(cb_id)
00072         self.assertEqual(self.hook.callbacks, [])

Here is the call graph for this function:


Member Data Documentation

Definition at line 29 of file hooks_tests.py.

Definition at line 33 of file hooks_tests.py.

Definition at line 26 of file hooks_tests.py.

Definition at line 30 of file hooks_tests.py.

Definition at line 34 of file hooks_tests.py.


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