# Path: mfr/server/app.py
# def make_app(debug):
#     app = tornado.web.Application(
#         [
#             (r'/static/(.*)', tornado.web.StaticFileHandler, {'path': server_settings.STATIC_PATH}),
#             (r'/assets/(.*?)/(.*\..*)', ExtensionsStaticFileHandler),
#             (r'/export', ExportHandler),
#             (r'/exporters', ExportersHandler),
#             (r'/render', RenderHandler),
#             (r'/renderers', RenderersHandler),
#             (r'/status', StatusHandler),
#         ],
#         debug=debug,
#         log_function=almost_apache_style_log,
#     )
#     app.sentry_client = AsyncSentryClient(settings.SENTRY_DSN, release=__version__)
#     return app
# 
# Path: mfr/core/provider.py
# class BaseProvider(metaclass=abc.ABCMeta):
#     """Base class for MFR Providers.  Requires ``download`` and ``metadata`` methods.
#     Validates that the given file url is hosted at a domain listed in
#     `mfr.server.settings.ALLOWED_PROVIDER_DOMAINS`.
#     """
# 
#     def __init__(self, request, url, action=None):
#         self.request = request
#         url_netloc = furl.furl(url).netloc
#         if url_netloc not in settings.ALLOWED_PROVIDER_NETLOCS:
#             raise exceptions.ProviderError(
#                 message="{} is not a permitted provider domain.".format(
#                     markupsafe.escape(url_netloc)
#                 ),
#                 code=400
#             )
#         self.url = url
#         self.action = action
#         self.provider_metrics = MetricsRecord('provider')
#         self.metrics = self.provider_metrics.new_subrecord(self.NAME)
# 
#         self.provider_metrics.merge({
#             'type': self.NAME,
#             'url': str(self.url),
#         })
# 
#     @abc.abstractproperty
#     def NAME(self):
#         raise NotImplementedError
# 
#     @abc.abstractmethod
#     def metadata(self):
#         pass
# 
#     @abc.abstractmethod
#     def download(self):
#         pass


import pytest
from unittest import mock
from tornado import testing
from tornado.platform.asyncio import AsyncIOMainLoop
from mfr.server.app import make_app
from mfr.core.provider import BaseProvider
    pass


class HandlerTestCase(testing.AsyncHTTPTestCase):

    def setUp(self):
        super().setUp()
        # identity_future = asyncio.Future()
        # identity_future.set_result({
        #     'auth': {},
        #     'credentials': {},
        #     'settings': {},
        # })
        # self.mock_identity = mock.Mock()
        # self.mock_identity.return_value = identity_future
        # self.identity_patcher = mock.patch('waterbutler.server.handlers.core.auth_handler.fetch', self.mock_identity)

        # self.mock_provider = MockProvider1({}, {}, {})
        # self.mock_make_provider = mock.Mock(return_value=self.mock_provider)
        # self.make_provider_patcher = mock.patch('waterbutler.core.utils.make_provider', self.mock_make_provider)

        # self.identity_patcher.start()
        # self.make_provider_patcher.start()

    def tearDown(self):
        super().tearDown()
        # self.identity_patcher.stop()
        # self.make_provider_patcher.stop()

    def get_app(self):

# Path: mfr/server/app.py
# def make_app(debug):
#     app = tornado.web.Application(
#         [
#             (r'/static/(.*)', tornado.web.StaticFileHandler, {'path': server_settings.STATIC_PATH}),
#             (r'/assets/(.*?)/(.*\..*)', ExtensionsStaticFileHandler),
#             (r'/export', ExportHandler),
#             (r'/exporters', ExportersHandler),
#             (r'/render', RenderHandler),
#             (r'/renderers', RenderersHandler),
#             (r'/status', StatusHandler),
#         ],
#         debug=debug,
#         log_function=almost_apache_style_log,
#     )
#     app.sentry_client = AsyncSentryClient(settings.SENTRY_DSN, release=__version__)
#     return app
# 
# Path: mfr/core/provider.py
# class BaseProvider(metaclass=abc.ABCMeta):
#     """Base class for MFR Providers.  Requires ``download`` and ``metadata`` methods.
#     Validates that the given file url is hosted at a domain listed in
#     `mfr.server.settings.ALLOWED_PROVIDER_DOMAINS`.
#     """
# 
#     def __init__(self, request, url, action=None):
#         self.request = request
#         url_netloc = furl.furl(url).netloc
#         if url_netloc not in settings.ALLOWED_PROVIDER_NETLOCS:
#             raise exceptions.ProviderError(
#                 message="{} is not a permitted provider domain.".format(
#                     markupsafe.escape(url_netloc)
#                 ),
#                 code=400
#             )
#         self.url = url
#         self.action = action
#         self.provider_metrics = MetricsRecord('provider')
#         self.metrics = self.provider_metrics.new_subrecord(self.NAME)
# 
#         self.provider_metrics.merge({
#             'type': self.NAME,
#             'url': str(self.url),
#         })
# 
#     @abc.abstractproperty
#     def NAME(self):
#         raise NotImplementedError
# 
#     @abc.abstractmethod
#     def metadata(self):
#         pass
# 
#     @abc.abstractmethod
#     def download(self):
#         pass


# Path: tests/utils.py
import pytest
from unittest import mock
from tornado import testing
from tornado.platform.asyncio import AsyncIOMainLoop
from mfr.server.app import make_app
from mfr.core.provider import BaseProvider

    pass


class HandlerTestCase(testing.AsyncHTTPTestCase):

    def setUp(self):
        super().setUp()
        # identity_future = asyncio.Future()
        # identity_future.set_result({
        #     'auth': {},
        #     'credentials': {},
        #     'settings': {},
        # })
        # self.mock_identity = mock.Mock()
        # self.mock_identity.return_value = identity_future
        # self.identity_patcher = mock.patch('waterbutler.server.handlers.core.auth_handler.fetch', self.mock_identity)

        # self.mock_provider = MockProvider1({}, {}, {})
        # self.mock_make_provider = mock.Mock(return_value=self.mock_provider)
        # self.make_provider_patcher = mock.patch('waterbutler.core.utils.make_provider', self.mock_make_provider)

        # self.identity_patcher.start()
        # self.make_provider_patcher.start()

    def tearDown(self):
        super().tearDown()
        # self.identity_patcher.stop()
        # self.make_provider_patcher.stop()

    def get_app(self):

        return make_app(debug=False)