コード例 #1
0
 def _get_fake_response(self, raw_response=None, exc=False):
     if exc:
         return messaging.Response(self.ctxt, 'fake',
                                   test.TestingException(),
                                   True)
     if raw_response is None:
         raw_response = 'fake-response'
     return messaging.Response(self.ctxt, 'fake', raw_response, False)
コード例 #2
0
def fake_get_flavor_by_flavor_id(flavorid, ctxt=None, read_deleted='yes'):
    if flavorid == 'failtest':
        raise exception.FlavorNotFound(flavor_id=flavorid)
    elif not str(flavorid) == '1234':
        raise Exception("This test expects flavorid 1234, not %s" % flavorid)
    if read_deleted != 'no':
        raise test.TestingException("Should not be reading deleted")
    return fake_db_flavor(flavorid=flavorid)
コード例 #3
0
ファイル: test_claims.py プロジェクト: 2Exception/patron
    def _abort(self):
        claim = None
        try:
            with self._claim(memory_mb=4096) as claim:
                raise test.TestingException("abort")
        except test.TestingException:
            pass

        return claim
コード例 #4
0
    def test_send_api_fault(self):
        self.flags(notify_api_faults=True)
        exception = None
        try:
            # Get a real exception with a call stack.
            raise test.TestingException("junk")
        except test.TestingException as e:
            exception = e

        notifications.send_api_fault("http://example.com/foo", 500, exception)

        self.assertEqual(1, len(fake_notifier.NOTIFICATIONS))
        n = fake_notifier.NOTIFICATIONS[0]
        self.assertEqual(n.priority, 'ERROR')
        self.assertEqual(n.event_type, 'api.fault')
        self.assertEqual(n.payload['url'], 'http://example.com/foo')
        self.assertEqual(n.payload['status'], 500)
        self.assertIsNotNone(n.payload['exception'])
コード例 #5
0
ファイル: test_monitors.py プロジェクト: 2Exception/patron
 def get_metric_names(self):
     raise test.TestingException()
コード例 #6
0
ファイル: test_monitors.py プロジェクト: 2Exception/patron
 def get_metrics(self, **kwargs):
     raise test.TestingException()
コード例 #7
0
 def no_mtu(*args, **kwargs):
     if 'mtu' in kwargs:
         raise test.TestingException("mtu should not pass through")
     return [{}]
コード例 #8
0
 def error_apply():
     raise test.TestingException()
コード例 #9
0
 def async_wrapper():
     raise test.TestingException()
コード例 #10
0
 def _fake_exit(error):
     raise test.TestingException()
コード例 #11
0
 def _test(self, *args):
     raise test.TestingException("shouldn't be called")
コード例 #12
0
 def fake_grab_target_cells(filter_properties):
     call_info['num_tries'] += 1
     raise test.TestingException()
コード例 #13
0
def bad_function_exception(self, context, extra, blah="a", boo="b", zoo=None):
    raise test.TestingException()
コード例 #14
0
 def test_get_image_meta_unexpected_exception(self):
     error = test.TestingException()
     with testtools.ExpectedException(test.TestingException):
         self._test_get_image_meta_exception(error)
コード例 #15
0
def bad_fetcher(image_id):
    raise test.TestingException("just plain bad.")