# Path: hamster_lib/helpers/config_helpers.py
# class HamsterAppDirs(appdirs.AppDirs):
#     def __init__(self, *args, **kwargs):
#     def user_data_dir(self):
#     def site_data_dir(self):
#     def user_config_dir(self):
#     def site_config_dir(self):
#     def user_cache_dir(self):
#     def user_log_dir(self):
#     def _ensure_directory_exists(self, directory):
# def get_config_path(appdirs=DEFAULT_APPDIRS, file_name=DEFAULT_CONFIG_FILENAME):
# def write_config_file(config_instance, appdirs=DEFAULT_APPDIRS,
#         file_name=DEFAULT_CONFIG_FILENAME):
# def load_config_file(appdirs=DEFAULT_APPDIRS, file_name=DEFAULT_CONFIG_FILENAME,
#         fallback_config_instance=None):
# def get_default_backend_config(appdirs):
# def backend_config_to_configparser(config):
#     def get_store():
#     def get_day_start():
#     def get_fact_min_delta():
#     def get_tmpfile_path():
#     def get_db_engine():
#     def get_db_path():
#     def get_db_host():
#     def get_db_port():
#     def get_db_name():
#     def get_db_user():
#     def get_db_password():
# def configparser_to_backend_config(cp_instance):
#     def get_store():
#     def get_day_start():
#     def get_fact_min_delta():
#     def get_tmpfile_path():
#     def get_db_engine():
#     def get_db_path():
#     def get_db_host():
#     def get_db_port():
#     def get_db_name():
#     def get_db_user():
#     def get_db_password():
# DEFAULT_APP_NAME = 'projecthamster'
# DEFAULT_APPDIRS = HamsterAppDirs(DEFAULT_APP_NAME)
# DEFAULT_CONFIG_FILENAME = '{}.conf'.format(DEFAULT_APPDIRS.appname)
# 
# Path: hamster_lib/helpers/config_helpers.py
# class HamsterAppDirs(appdirs.AppDirs):
#     """Custom class that ensure appdirs exist."""
# 
#     def __init__(self, *args, **kwargs):
#         """Add create flag value to instance."""
#         super(HamsterAppDirs, self).__init__(*args, **kwargs)
#         self.create = True
# 
#     @property
#     def user_data_dir(self):
#         """Return ``user_data_dir``."""
#         directory = appdirs.user_data_dir(self.appname, self.appauthor,
#                              version=self.version, roaming=self.roaming)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     @property
#     def site_data_dir(self):
#         """Return ``site_data_dir``."""
#         directory = appdirs.site_data_dir(self.appname, self.appauthor,
#                              version=self.version, multipath=self.multipath)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     @property
#     def user_config_dir(self):
#         """Return ``user_config_dir``."""
#         directory = appdirs.user_config_dir(self.appname, self.appauthor,
#                                version=self.version, roaming=self.roaming)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     @property
#     def site_config_dir(self):
#         """Return ``site_config_dir``."""
#         directory = appdirs.site_config_dir(self.appname, self.appauthor,
#                              version=self.version, multipath=self.multipath)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     @property
#     def user_cache_dir(self):
#         """Return ``user_cache_dir``."""
#         directory = appdirs.user_cache_dir(self.appname, self.appauthor,
#                               version=self.version)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     @property
#     def user_log_dir(self):
#         """Return ``user_log_dir``."""
#         directory = appdirs.user_log_dir(self.appname, self.appauthor,
#                             version=self.version)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     def _ensure_directory_exists(self, directory):
#         """Ensure that the passed path exists."""
#         if not os.path.lexists(directory):
#             os.makedirs(directory)
#         return directory


import os
import pytest
from configparser import ConfigParser
from hamster_lib.helpers import config_helpers
from hamster_lib.helpers.config_helpers import HamsterAppDirs
# -*- coding: utf-8 -*-


from __future__ import absolute_import, unicode_literals




class TestHamsterAppDirs(object):
    """Make sure that our custom AppDirs works as intended."""

    def test_user_data_dir_returns_directoy(self, tmpdir, mocker):
        """Make sure method returns directory."""
        path = tmpdir.strpath
        mocker.patch('hamster_lib.helpers.config_helpers.appdirs.user_data_dir', return_value=path)

# Path: hamster_lib/helpers/config_helpers.py
# class HamsterAppDirs(appdirs.AppDirs):
#     def __init__(self, *args, **kwargs):
#     def user_data_dir(self):
#     def site_data_dir(self):
#     def user_config_dir(self):
#     def site_config_dir(self):
#     def user_cache_dir(self):
#     def user_log_dir(self):
#     def _ensure_directory_exists(self, directory):
# def get_config_path(appdirs=DEFAULT_APPDIRS, file_name=DEFAULT_CONFIG_FILENAME):
# def write_config_file(config_instance, appdirs=DEFAULT_APPDIRS,
#         file_name=DEFAULT_CONFIG_FILENAME):
# def load_config_file(appdirs=DEFAULT_APPDIRS, file_name=DEFAULT_CONFIG_FILENAME,
#         fallback_config_instance=None):
# def get_default_backend_config(appdirs):
# def backend_config_to_configparser(config):
#     def get_store():
#     def get_day_start():
#     def get_fact_min_delta():
#     def get_tmpfile_path():
#     def get_db_engine():
#     def get_db_path():
#     def get_db_host():
#     def get_db_port():
#     def get_db_name():
#     def get_db_user():
#     def get_db_password():
# def configparser_to_backend_config(cp_instance):
#     def get_store():
#     def get_day_start():
#     def get_fact_min_delta():
#     def get_tmpfile_path():
#     def get_db_engine():
#     def get_db_path():
#     def get_db_host():
#     def get_db_port():
#     def get_db_name():
#     def get_db_user():
#     def get_db_password():
# DEFAULT_APP_NAME = 'projecthamster'
# DEFAULT_APPDIRS = HamsterAppDirs(DEFAULT_APP_NAME)
# DEFAULT_CONFIG_FILENAME = '{}.conf'.format(DEFAULT_APPDIRS.appname)
# 
# Path: hamster_lib/helpers/config_helpers.py
# class HamsterAppDirs(appdirs.AppDirs):
#     """Custom class that ensure appdirs exist."""
# 
#     def __init__(self, *args, **kwargs):
#         """Add create flag value to instance."""
#         super(HamsterAppDirs, self).__init__(*args, **kwargs)
#         self.create = True
# 
#     @property
#     def user_data_dir(self):
#         """Return ``user_data_dir``."""
#         directory = appdirs.user_data_dir(self.appname, self.appauthor,
#                              version=self.version, roaming=self.roaming)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     @property
#     def site_data_dir(self):
#         """Return ``site_data_dir``."""
#         directory = appdirs.site_data_dir(self.appname, self.appauthor,
#                              version=self.version, multipath=self.multipath)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     @property
#     def user_config_dir(self):
#         """Return ``user_config_dir``."""
#         directory = appdirs.user_config_dir(self.appname, self.appauthor,
#                                version=self.version, roaming=self.roaming)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     @property
#     def site_config_dir(self):
#         """Return ``site_config_dir``."""
#         directory = appdirs.site_config_dir(self.appname, self.appauthor,
#                              version=self.version, multipath=self.multipath)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     @property
#     def user_cache_dir(self):
#         """Return ``user_cache_dir``."""
#         directory = appdirs.user_cache_dir(self.appname, self.appauthor,
#                               version=self.version)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     @property
#     def user_log_dir(self):
#         """Return ``user_log_dir``."""
#         directory = appdirs.user_log_dir(self.appname, self.appauthor,
#                             version=self.version)
#         if self.create:
#             self._ensure_directory_exists(directory)
#         return directory
# 
#     def _ensure_directory_exists(self, directory):
#         """Ensure that the passed path exists."""
#         if not os.path.lexists(directory):
#             os.makedirs(directory)
#         return directory


# Path: tests/helpers/test_config_helpers.py
import os
import pytest
from configparser import ConfigParser
from hamster_lib.helpers import config_helpers
from hamster_lib.helpers.config_helpers import HamsterAppDirs

# -*- coding: utf-8 -*-


from __future__ import absolute_import, unicode_literals




class TestHamsterAppDirs(object):
    """Make sure that our custom AppDirs works as intended."""

    def test_user_data_dir_returns_directoy(self, tmpdir, mocker):
        """Make sure method returns directory."""
        path = tmpdir.strpath
        mocker.patch('hamster_lib.helpers.config_helpers.appdirs.user_data_dir', return_value=path)

        appdir = HamsterAppDirs('hamster-lib')