added test

This commit is contained in:
Andreas Preikschat 2014-03-31 19:01:09 +02:00
parent 6204454bfb
commit c451a8eafa
3 changed files with 16 additions and 1 deletions

View File

@ -151,6 +151,7 @@ class Registry(object):
if result:
results.append(result)
except TypeError:
print("sdf")
# Who has called me can help in debugging
trace_error_handler(log)
log.exception('Exception for function %s', function)

View File

@ -30,7 +30,7 @@
"""
This script helps to trigger builds of branches. To use it you have to install the jenkins-webapi package:
pip3 isntall jenkins-webapi
pip3 install jenkins-webapi
You probably want to create an alias. Add this to your ~/.bashrc file and then logout and login (to apply the alias):

View File

@ -100,6 +100,20 @@ class TestRegistry(TestCase):
# THEN: I expect then function to have been called and a return given
self.assertEqual(return_value[0], 'function_2', 'A return value is provided and matches')
def remove_function_test(self):
"""
Test the remove_function() method
"""
# GIVEN: An existing registry register a function
Registry.create()
Registry().register_function('test1', self.dummy_function_1)
# WHEN: Remove the function.
Registry().remove_function('test1', self.dummy_function_1)
# THEN: The method should not be available.
assert not Registry().functions_list['test1'], 'The function should not be in the dict anymore.'
def dummy_function_1(self):
return "function_1"