# Path: osprofiler/opts.py
# _PROFILER_OPTS = [
#     _enabled_opt,
#     _trace_sqlalchemy_opt,
#     _hmac_keys_opt,
#     _connection_string_opt,
#     _es_doc_type_opt,
#     _es_scroll_time_opt,
#     _es_scroll_size_opt,
#     _socket_timeout_opt,
#     _sentinel_service_name_opt,
#     _filter_error_trace
# ]
# def set_defaults(conf, enabled=None, trace_sqlalchemy=None, hmac_keys=None,
#                  connection_string=None, es_doc_type=None,
#                  es_scroll_time=None, es_scroll_size=None,
#                  socket_timeout=None, sentinel_service_name=None):
# def is_trace_enabled(conf=None):
# def is_db_trace_enabled(conf=None):
# def enable_web_trace(conf=None):
# def disable_web_trace(conf=None):
# def list_opts():
# 
# Path: osprofiler/tests/test.py
# class TestCase(testcase.TestCase):
# class FunctionalTestCase(TestCase):
#     def setUp(self):


from unittest import mock
from oslo_config import fixture
from osprofiler import opts
from osprofiler.tests import test
        self.assertEqual("SECRET_KEY",
                         self.conf_fixture.conf.profiler.hmac_keys)
        self.assertFalse(opts.is_trace_enabled(self.conf_fixture.conf))
        self.assertFalse(opts.is_db_trace_enabled(self.conf_fixture.conf))

    def test_options_defaults_override(self):
        opts.set_defaults(self.conf_fixture.conf, enabled=True,
                          trace_sqlalchemy=True,
                          hmac_keys="MY_KEY")
        self.assertTrue(self.conf_fixture.conf.profiler.enabled)
        self.assertTrue(self.conf_fixture.conf.profiler.trace_sqlalchemy)
        self.assertEqual("MY_KEY",
                         self.conf_fixture.conf.profiler.hmac_keys)
        self.assertTrue(opts.is_trace_enabled(self.conf_fixture.conf))
        self.assertTrue(opts.is_db_trace_enabled(self.conf_fixture.conf))

    @mock.patch("osprofiler.web.enable")
    @mock.patch("osprofiler.web.disable")
    def test_web_trace_disabled(self, mock_disable, mock_enable):
        opts.set_defaults(self.conf_fixture.conf, hmac_keys="MY_KEY")
        opts.enable_web_trace(self.conf_fixture.conf)
        opts.disable_web_trace(self.conf_fixture.conf)
        self.assertEqual(0, mock_enable.call_count)
        self.assertEqual(0, mock_disable.call_count)

    @mock.patch("osprofiler.web.enable")
    @mock.patch("osprofiler.web.disable")
    def test_web_trace_enabled(self, mock_disable, mock_enable):
        opts.set_defaults(self.conf_fixture.conf, enabled=True,
                          hmac_keys="MY_KEY")

# Path: osprofiler/opts.py
# _PROFILER_OPTS = [
#     _enabled_opt,
#     _trace_sqlalchemy_opt,
#     _hmac_keys_opt,
#     _connection_string_opt,
#     _es_doc_type_opt,
#     _es_scroll_time_opt,
#     _es_scroll_size_opt,
#     _socket_timeout_opt,
#     _sentinel_service_name_opt,
#     _filter_error_trace
# ]
# def set_defaults(conf, enabled=None, trace_sqlalchemy=None, hmac_keys=None,
#                  connection_string=None, es_doc_type=None,
#                  es_scroll_time=None, es_scroll_size=None,
#                  socket_timeout=None, sentinel_service_name=None):
# def is_trace_enabled(conf=None):
# def is_db_trace_enabled(conf=None):
# def enable_web_trace(conf=None):
# def disable_web_trace(conf=None):
# def list_opts():
# 
# Path: osprofiler/tests/test.py
# class TestCase(testcase.TestCase):
# class FunctionalTestCase(TestCase):
#     def setUp(self):


# Path: osprofiler/tests/unit/test_opts.py
from unittest import mock
from oslo_config import fixture
from osprofiler import opts
from osprofiler.tests import test

        self.assertEqual("SECRET_KEY",
                         self.conf_fixture.conf.profiler.hmac_keys)
        self.assertFalse(opts.is_trace_enabled(self.conf_fixture.conf))
        self.assertFalse(opts.is_db_trace_enabled(self.conf_fixture.conf))

    def test_options_defaults_override(self):
        opts.set_defaults(self.conf_fixture.conf, enabled=True,
                          trace_sqlalchemy=True,
                          hmac_keys="MY_KEY")
        self.assertTrue(self.conf_fixture.conf.profiler.enabled)
        self.assertTrue(self.conf_fixture.conf.profiler.trace_sqlalchemy)
        self.assertEqual("MY_KEY",
                         self.conf_fixture.conf.profiler.hmac_keys)
        self.assertTrue(opts.is_trace_enabled(self.conf_fixture.conf))
        self.assertTrue(opts.is_db_trace_enabled(self.conf_fixture.conf))

    @mock.patch("osprofiler.web.enable")
    @mock.patch("osprofiler.web.disable")
    def test_web_trace_disabled(self, mock_disable, mock_enable):
        opts.set_defaults(self.conf_fixture.conf, hmac_keys="MY_KEY")
        opts.enable_web_trace(self.conf_fixture.conf)
        opts.disable_web_trace(self.conf_fixture.conf)
        self.assertEqual(0, mock_enable.call_count)
        self.assertEqual(0, mock_disable.call_count)

    @mock.patch("osprofiler.web.enable")
    @mock.patch("osprofiler.web.disable")
    def test_web_trace_enabled(self, mock_disable, mock_enable):
        opts.set_defaults(self.conf_fixture.conf, enabled=True,
                          hmac_keys="MY_KEY")

        opts.enable_web_trace(self.conf_fixture.conf)