# Path: templar/api/config.py
# class ConfigBuilderError(TemplarError):
#     pass
# 
# Path: templar/cli/templar.py
# LOGGING_FORMAT = '%(levelname)s %(filename)s:%(lineno)d> %(message)s'
# def flags(args=None):
# def run(args):
# def main():


from templar.api.config import ConfigBuilderError
from templar.cli import templar
import io
import mock
import os.path
import shutil
import unittest
"""End-to-end test for templar/cli/templar.py"""



STAGING_DIR = os.path.join('tests', 'cli', 'staging')
TEST_DATA = os.path.join('tests', 'cli', 'test_data')

class TemplarTest(unittest.TestCase):
    def setUp(self):
        os.mkdir(STAGING_DIR)

    def tearDown(self):
        shutil.rmtree(STAGING_DIR)

    def testConfigNotFound(self):
        with self.assertRaises(ConfigBuilderError) as cm:
            templar.run(templar.flags([
                '-s', os.path.join(TEST_DATA, 'file.md'),
                '-c', os.path.join('no', 'such', 'config.py'),
                '--debug',
            ]))
        self.assertEqual('Could not find config file: no/such/config.py', str(cm.exception))

    def testConfig_withNoVariableFails(self):

# Path: templar/api/config.py
# class ConfigBuilderError(TemplarError):
#     pass
# 
# Path: templar/cli/templar.py
# LOGGING_FORMAT = '%(levelname)s %(filename)s:%(lineno)d> %(message)s'
# def flags(args=None):
# def run(args):
# def main():


# Path: tests/cli/templar_test.py
from templar.api.config import ConfigBuilderError
from templar.cli import templar
import io
import mock
import os.path
import shutil
import unittest

"""End-to-end test for templar/cli/templar.py"""



STAGING_DIR = os.path.join('tests', 'cli', 'staging')
TEST_DATA = os.path.join('tests', 'cli', 'test_data')

class TemplarTest(unittest.TestCase):
    def setUp(self):
        os.mkdir(STAGING_DIR)

    def tearDown(self):
        shutil.rmtree(STAGING_DIR)

    def testConfigNotFound(self):
        with self.assertRaises(ConfigBuilderError) as cm:
            templar.run(templar.flags([
                '-s', os.path.join(TEST_DATA, 'file.md'),
                '-c', os.path.join('no', 'such', 'config.py'),
                '--debug',
            ]))
        self.assertEqual('Could not find config file: no/such/config.py', str(cm.exception))

    def testConfig_withNoVariableFails(self):

        with self.assertRaises(ConfigBuilderError) as cm: