# Path: statik/generator.py
# def generate(input_path, output_path=None, in_memory=False, safe_mode=False, deploy_method=None, error_context=None):
#     """Executes the Statik site generator using the given parameters.
#     """
#     project = StatikProject(input_path, safe_mode=safe_mode, error_context=error_context)
#     return project.generate(output_path=output_path, in_memory=in_memory, deploy_method=deploy_method)


import os.path
import xml.etree.ElementTree as ET
import unittest
from statik.generator import generate
# -*- coding: utf-8 -*-




class TestThemedStatikProject(unittest.TestCase):

    def test_theme1(self):
        test_path = os.path.dirname(os.path.realpath(__file__))
        output_data = generate(
            os.path.join(test_path, 'data-themed', 'config-theme1.yml'),
            os.path.join(test_path, 'data-themed'),
            in_memory=True,
        )

        self.assertIn('index.html', output_data)
        self.assertIn('override-me', output_data)
        self.assertIn('index.html', output_data['override-me'])

        # parse the home page
        homepage = ET.fromstring(output_data['index.html'])
        self.assertEqual('Home - Theme 1', homepage.findall('./head/title')[0].text.strip())
        self.assertEqual('/assets/theme1.css', homepage.findall('./head/link')[0].attrib['href'])

        self.check_override_page(output_data['override-me']['index.html'])

    def test_theme2(self):
        test_path = os.path.dirname(os.path.realpath(__file__))

# Path: statik/generator.py
# def generate(input_path, output_path=None, in_memory=False, safe_mode=False, deploy_method=None, error_context=None):
#     """Executes the Statik site generator using the given parameters.
#     """
#     project = StatikProject(input_path, safe_mode=safe_mode, error_context=error_context)
#     return project.generate(output_path=output_path, in_memory=in_memory, deploy_method=deploy_method)


# Path: tests/integration/test_themed.py
import os.path
import xml.etree.ElementTree as ET
import unittest
from statik.generator import generate

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




class TestThemedStatikProject(unittest.TestCase):

    def test_theme1(self):
        test_path = os.path.dirname(os.path.realpath(__file__))
        output_data = generate(
            os.path.join(test_path, 'data-themed', 'config-theme1.yml'),
            os.path.join(test_path, 'data-themed'),
            in_memory=True,
        )

        self.assertIn('index.html', output_data)
        self.assertIn('override-me', output_data)
        self.assertIn('index.html', output_data['override-me'])

        # parse the home page
        homepage = ET.fromstring(output_data['index.html'])
        self.assertEqual('Home - Theme 1', homepage.findall('./head/title')[0].text.strip())
        self.assertEqual('/assets/theme1.css', homepage.findall('./head/link')[0].attrib['href'])

        self.check_override_page(output_data['override-me']['index.html'])

    def test_theme2(self):
        test_path = os.path.dirname(os.path.realpath(__file__))

        output_data = generate(