Exemple #1
0
 def test_wrap_exception_with_notifier(self):
     notifier = FakeNotifier()
     wrapped = exception.wrap_exception(notifier)
     ctxt = context.get_admin_context()
     self.assertRaises(test.TestingException,
                       wrapped(bad_function_exception), 1, ctxt, 3, zoo=3)
     self.assertEqual(notifier.provided_event, "bad_function_exception")
     self.assertEqual(notifier.provided_context, ctxt)
     self.assertEqual(notifier.provided_payload['args']['extra'], 3)
     for key in ['exception', 'args']:
         self.assertIn(key, notifier.provided_payload.keys())
Exemple #2
0
 def test_wrap_exception_with_notifier(self):
     notifier = FakeNotifier()
     wrapped = exception.wrap_exception(notifier)
     ctxt = context.get_admin_context()
     self.assertRaises(test.TestingException,
                       wrapped(bad_function_exception),
                       1,
                       ctxt,
                       3,
                       zoo=3)
     self.assertEqual(notifier.provided_event, "bad_function_exception")
     self.assertEqual(notifier.provided_context, ctxt)
     self.assertEqual(notifier.provided_payload['args']['extra'], 3)
     for key in ['exception', 'args']:
         self.assertIn(key, notifier.provided_payload.keys())
Exemple #3
0
 def test_wrap_exception_good_return(self):
     wrapped = exception.wrap_exception('foo')
     self.assertEqual(99, wrapped(good_function)(1, 2))
Exemple #4
0
 def test_wrap_exception_good_return(self):
     wrapped = exception.wrap_exception('foo')
     self.assertEqual(99, wrapped(good_function)(1, 2))