# Path: marvin_python_toolbox/common/config.py
# def load_conf_from_file(path=None, section='marvin'):
#     def reset(cls):
#     def _load(cls, section=None):
#     def get(cls, key, section=None, **kwargs):
#     def keys(cls, section=None):
# DEFAULT_PREFIX = 'marvin.'
# DEFAULT_SECT = 'marvin'
#     PREFIX = DEFAULT_PREFIX
# class Configuration(object):
# 
# Path: marvin_python_toolbox/common/exceptions.py
# class InvalidConfigException(ConfigException):
#     """
#     Invalid Marvin Config Base Exception
#     """


import pytest
import os
    import mock
    import unittest.mock as mock
from marvin_python_toolbox.common.config import Config, load_conf_from_file
from marvin_python_toolbox.common.exceptions import InvalidConfigException
        from configparser import NoSectionError

        ConfigParserMocked.assert_called_once_with(filepath)

    @mock.patch('marvin_python_toolbox.common.config.ConfigObj')
    def test_load_conf_from_default_path(self, ConfigParserMocked):
        load_conf_from_file()

        ConfigParserMocked.assert_called_once_with(os.environ['DEFAULT_CONFIG_PATH'])

    @mock.patch('marvin_python_toolbox.common.config.logger')
    @mock.patch('marvin_python_toolbox.common.config.ConfigObj.__getitem__')
    def test_load_conf_from_default_path_with_invalid_section(self, ConfigParserGetItemMocked, logger_mocked):

        filepath = '/path/to/config/file.ini'

        ConfigParserGetItemMocked.side_effect = NoSectionError('')
        assert len(load_conf_from_file(filepath, section='invalidsection')) == 0
        logger_mocked.warn.assert_called_once_with(
            "Couldn't find \"invalidsection\" section in \"/path/to/config/file.ini\""
        )

    @mock.patch('marvin_python_toolbox.common.config.load_conf_from_file')
    def test_get(self, load_conf_from_file_mocked, config_fixture):
        load_conf_from_file_mocked.return_value = config_fixture
        assert Config.get('key') == config_fixture['key']

    @mock.patch('marvin_python_toolbox.common.config.load_conf_from_file')
    def test_get_invalid_key(self, load_conf_from_file_mocked, config_fixture):
        load_conf_from_file_mocked.return_value = config_fixture
        assert 'invalidkey' not in config_fixture

# Path: marvin_python_toolbox/common/config.py
# def load_conf_from_file(path=None, section='marvin'):
#     def reset(cls):
#     def _load(cls, section=None):
#     def get(cls, key, section=None, **kwargs):
#     def keys(cls, section=None):
# DEFAULT_PREFIX = 'marvin.'
# DEFAULT_SECT = 'marvin'
#     PREFIX = DEFAULT_PREFIX
# class Configuration(object):
# 
# Path: marvin_python_toolbox/common/exceptions.py
# class InvalidConfigException(ConfigException):
#     """
#     Invalid Marvin Config Base Exception
#     """


# Path: tests/common/test_config.py
import pytest
import os
    import mock
    import unittest.mock as mock
from marvin_python_toolbox.common.config import Config, load_conf_from_file
from marvin_python_toolbox.common.exceptions import InvalidConfigException
        from configparser import NoSectionError


        ConfigParserMocked.assert_called_once_with(filepath)

    @mock.patch('marvin_python_toolbox.common.config.ConfigObj')
    def test_load_conf_from_default_path(self, ConfigParserMocked):
        load_conf_from_file()

        ConfigParserMocked.assert_called_once_with(os.environ['DEFAULT_CONFIG_PATH'])

    @mock.patch('marvin_python_toolbox.common.config.logger')
    @mock.patch('marvin_python_toolbox.common.config.ConfigObj.__getitem__')
    def test_load_conf_from_default_path_with_invalid_section(self, ConfigParserGetItemMocked, logger_mocked):

        filepath = '/path/to/config/file.ini'

        ConfigParserGetItemMocked.side_effect = NoSectionError('')
        assert len(load_conf_from_file(filepath, section='invalidsection')) == 0
        logger_mocked.warn.assert_called_once_with(
            "Couldn't find \"invalidsection\" section in \"/path/to/config/file.ini\""
        )

    @mock.patch('marvin_python_toolbox.common.config.load_conf_from_file')
    def test_get(self, load_conf_from_file_mocked, config_fixture):
        load_conf_from_file_mocked.return_value = config_fixture
        assert Config.get('key') == config_fixture['key']

    @mock.patch('marvin_python_toolbox.common.config.load_conf_from_file')
    def test_get_invalid_key(self, load_conf_from_file_mocked, config_fixture):
        load_conf_from_file_mocked.return_value = config_fixture
        assert 'invalidkey' not in config_fixture

        with pytest.raises(InvalidConfigException):