# Path: honeybadger/plugins.py
# class Plugin(object):
# class PluginManager(object):
#     def __init__(self, name):
#     def supports(self, config, context):
#     def generate_payload(self, config, context):
#     def __init__(self):
#     def register(self, plugin):
#     def generate_payload(self, default_payload, config=None, context=None):
# 
# Path: honeybadger/tests/contrib/test_django.py
# class DjangoMiddlewareTestCase(unittest.TestCase):
#     def setUp(self):
#         self.rf = RequestFactory()
#         self.url = url(r'test', plain_view, name='test_view')
# 
#     def tearDown(self):
#         clear_request()
# 
#     def get_response(self, request):
#         return Mock()
# 
#     @patch('honeybadger.contrib.django.honeybadger')
#     def test_process_exception(self, mock_hb):
#         request = self.rf.get('test')
#         request.resolver_match = self.url.resolve('test')
#         exc = ValueError('test exception')
# 
#         middleware = DjangoHoneybadgerMiddleware(self.get_response)
#         middleware.process_exception(request, exc)
# 
#         mock_hb.notify.assert_called_with(exc)
#         self.assertIsNone(current_request(), msg='Current request should be cleared after exception handling')
# 
#     def test___call__(self):
#         request = self.rf.get('test')
#         request.resolver_match = self.url.resolve('test')
# 
#         middleware = DjangoHoneybadgerMiddleware(self.get_response)
#         response = middleware(request)
# 
#         self.assertDictEqual({}, honeybadger._get_context(), msg='Context should be cleared after response handling')
#         self.assertIsNone(current_request(), msg='Current request should be cleared after response handling')
# 
# Path: honeybadger/middleware.py
# class DjangoHoneybadgerMiddleware(RealDjangoHoneybadgerMiddleware):
#     def __init__(self, *args, **kwargs):
#         warnings.warn("DjangoHoneybadgerMiddleware has moved! Update your imports to import it from honeybadger.contrib", FutureWarning)
#         super(DjangoHoneybadgerMiddleware, self).__init__(*args, **kwargs)


import warnings
from collections import OrderedDict
from honeybadger.plugins import default_plugin_manager
from .contrib.test_django import DjangoMiddlewareTestCase
from honeybadger.middleware import DjangoHoneybadgerMiddleware


__all__ = ['MiddlewareTestCase']


class MiddlewareTestCase(DjangoMiddlewareTestCase):
    def test_middleware_import_warning(self):
        default_plugin_manager._registered = OrderedDict()

# Path: honeybadger/plugins.py
# class Plugin(object):
# class PluginManager(object):
#     def __init__(self, name):
#     def supports(self, config, context):
#     def generate_payload(self, config, context):
#     def __init__(self):
#     def register(self, plugin):
#     def generate_payload(self, default_payload, config=None, context=None):
# 
# Path: honeybadger/tests/contrib/test_django.py
# class DjangoMiddlewareTestCase(unittest.TestCase):
#     def setUp(self):
#         self.rf = RequestFactory()
#         self.url = url(r'test', plain_view, name='test_view')
# 
#     def tearDown(self):
#         clear_request()
# 
#     def get_response(self, request):
#         return Mock()
# 
#     @patch('honeybadger.contrib.django.honeybadger')
#     def test_process_exception(self, mock_hb):
#         request = self.rf.get('test')
#         request.resolver_match = self.url.resolve('test')
#         exc = ValueError('test exception')
# 
#         middleware = DjangoHoneybadgerMiddleware(self.get_response)
#         middleware.process_exception(request, exc)
# 
#         mock_hb.notify.assert_called_with(exc)
#         self.assertIsNone(current_request(), msg='Current request should be cleared after exception handling')
# 
#     def test___call__(self):
#         request = self.rf.get('test')
#         request.resolver_match = self.url.resolve('test')
# 
#         middleware = DjangoHoneybadgerMiddleware(self.get_response)
#         response = middleware(request)
# 
#         self.assertDictEqual({}, honeybadger._get_context(), msg='Context should be cleared after response handling')
#         self.assertIsNone(current_request(), msg='Current request should be cleared after response handling')
# 
# Path: honeybadger/middleware.py
# class DjangoHoneybadgerMiddleware(RealDjangoHoneybadgerMiddleware):
#     def __init__(self, *args, **kwargs):
#         warnings.warn("DjangoHoneybadgerMiddleware has moved! Update your imports to import it from honeybadger.contrib", FutureWarning)
#         super(DjangoHoneybadgerMiddleware, self).__init__(*args, **kwargs)


# Path: honeybadger/tests/test_middleware.py
import warnings
from collections import OrderedDict
from honeybadger.plugins import default_plugin_manager
from .contrib.test_django import DjangoMiddlewareTestCase
from honeybadger.middleware import DjangoHoneybadgerMiddleware



__all__ = ['MiddlewareTestCase']


class MiddlewareTestCase(DjangoMiddlewareTestCase):
    def test_middleware_import_warning(self):
        default_plugin_manager._registered = OrderedDict()

        with warnings.catch_warnings(record=True) as w: