'fixed' tests

This commit is contained in:
Andreas Preikschat 2013-07-17 16:38:14 +02:00
parent 161a1db12d
commit 55fbe75695
1 changed files with 5 additions and 4 deletions

View File

@ -31,14 +31,14 @@ class TestRegistry(TestCase):
# THEN and I will get an exception # THEN and I will get an exception
with self.assertRaises(KeyError) as context: with self.assertRaises(KeyError) as context:
Registry().register(u'test1', mock_1) Registry().register(u'test1', mock_1)
self.assertEqual(context.exception[0], u'Duplicate service exception test1', self.assertEqual(context.exception, u'Duplicate service exception test1',
u'KeyError exception should have been thrown for duplicate service') u'KeyError exception should have been thrown for duplicate service')
# WHEN I try to get back a non existent component # WHEN I try to get back a non existent component
# THEN I will get an exception # THEN I will get an exception
with self.assertRaises(KeyError) as context: with self.assertRaises(KeyError) as context:
temp = Registry().get(u'test2') temp = Registry().get(u'test2')
self.assertEqual(context.exception[0], u'Service test2 not found in list', self.assertEqual(context.exception, u'Service test2 not found in list',
u'KeyError exception should have been thrown for missing service') u'KeyError exception should have been thrown for missing service')
# WHEN I try to replace a component I should be allowed (testing only) # WHEN I try to replace a component I should be allowed (testing only)
@ -46,7 +46,7 @@ class TestRegistry(TestCase):
# THEN I will get an exception # THEN I will get an exception
with self.assertRaises(KeyError) as context: with self.assertRaises(KeyError) as context:
temp = Registry().get(u'test1') temp = Registry().get(u'test1')
self.assertEqual(context.exception[0], u'Service test1 not found in list', self.assertEqual(context.exception, u'Service test1 not found in list',
u'KeyError exception should have been thrown for deleted service') u'KeyError exception should have been thrown for deleted service')
def registry_function_test(self): def registry_function_test(self):
@ -81,4 +81,5 @@ class TestRegistry(TestCase):
return "function_1" return "function_1"
def dummy_function_2(self): def dummy_function_2(self):
return "function_2" return "function_2"