# Path: simiki/config.py
# def parse_config(config_file):
#     if not os.path.exists(config_file):
#         raise ConfigFileNotFound("{0} not exists".format(config_file))
# 
#     default_config = _set_default_config()
# 
#     with io.open(config_file, "rt", encoding="utf-8") as fd:
#         config = yaml.load(fd, Loader=yaml.FullLoader)
# 
#     default_config.update(config)
#     config = _post_process(default_config)
# 
#     return config
# 
# def get_default_config():
#     return _post_process(_set_default_config())


import os.path
import unittest
import datetime
from simiki.config import parse_config, get_default_config
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

test_path = os.path.dirname(os.path.abspath(__file__))


class TestParseConfig(unittest.TestCase):
    def setUp(self):
        wiki_path = os.path.join(test_path, 'mywiki_for_others')

        self.expected_config = get_default_config()
        self.expected_config.update({
            "author": "Tanky Woo",
            "debug": True,
            "default_ext": "markdown",
            "description": "This is a simiki's config sample,"
                           " \u6d4b\u8bd5\u6837\u4f8b",
            "destination": "destination",
            "keywords": "wiki, simiki, python, \u7ef4\u57fa",
            "root": "/wiki/",
            "source": "source",
            "attach": "attach",
            "theme": "mytheme",
            "themes_dir": "simiki_themes",
            "title": "\u6211\u7684Wiki",
            "url": "http://wiki.tankywoo.com"
        })
        self.config_file = os.path.join(wiki_path, "config_sample.yml")

    def test_parse_config(self):

# Path: simiki/config.py
# def parse_config(config_file):
#     if not os.path.exists(config_file):
#         raise ConfigFileNotFound("{0} not exists".format(config_file))
# 
#     default_config = _set_default_config()
# 
#     with io.open(config_file, "rt", encoding="utf-8") as fd:
#         config = yaml.load(fd, Loader=yaml.FullLoader)
# 
#     default_config.update(config)
#     config = _post_process(default_config)
# 
#     return config
# 
# def get_default_config():
#     return _post_process(_set_default_config())


# Path: tests/test_parse_config.py
import os.path
import unittest
import datetime
from simiki.config import parse_config, get_default_config

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

test_path = os.path.dirname(os.path.abspath(__file__))


class TestParseConfig(unittest.TestCase):
    def setUp(self):
        wiki_path = os.path.join(test_path, 'mywiki_for_others')

        self.expected_config = get_default_config()
        self.expected_config.update({
            "author": "Tanky Woo",
            "debug": True,
            "default_ext": "markdown",
            "description": "This is a simiki's config sample,"
                           " \u6d4b\u8bd5\u6837\u4f8b",
            "destination": "destination",
            "keywords": "wiki, simiki, python, \u7ef4\u57fa",
            "root": "/wiki/",
            "source": "source",
            "attach": "attach",
            "theme": "mytheme",
            "themes_dir": "simiki_themes",
            "title": "\u6211\u7684Wiki",
            "url": "http://wiki.tankywoo.com"
        })
        self.config_file = os.path.join(wiki_path, "config_sample.yml")

    def test_parse_config(self):

        config = parse_config(self.config_file)