Ejemplo n.º 1
0
    def test_load_hooks_empty_directory(self):
        os.mkdir('hooks')

        e = Engine.__new__(Engine)
        e.load_hooks()

        self.assertFalse(hasattr(e, 'hooks'))
Ejemplo n.º 2
0
    def test_load_renderers_empty_directory(self):
        os.mkdir('renderers')

        e = Engine.__new__(Engine)
        e.load_renderers()

        self.assertIsInstance(e.renderers, dict)
        self.assertDictEqual(e.renderers, DefaultRenderers)
Ejemplo n.º 3
0
    def test_load_hooks(self):
        os.mkdir('hooks')
        with open(os.path.join('hooks', '__hooks__.py'), 'a') as f:
            f.write('hooks = { "name": "action" }\n')

        e = Engine.__new__(Engine)
        e.load_hooks()

        self.assertIsInstance(e.hooks, dict)
        self.assertIn('name', e.hooks)
        self.assertEqual(e.hooks['name'], 'action')
Ejemplo n.º 4
0
    def test_load_renderers(self):
        os.mkdir('renderers')
        with open(os.path.join('renderers', '__renderers__.py'), 'a') as f:
            f.write('renderers = { "html": "class" }\n')

        e = Engine.__new__(Engine)
        e.load_renderers()

        self.assertIsInstance(e.renderers, dict)
        self.assertDictContainsSubset(DefaultRenderers, e.renderers)
        self.assertIn('html', e.renderers)
        self.assertEqual(e.renderers['html'], 'class')
Ejemplo n.º 5
0
def build_site(site_dir):
    logging.info('Building site from source..')
    Engine.SITE_ROOT = site_dir
    Engine()
Ejemplo n.º 6
0
    def test_load_renderers_no_ext_renderers(self):
        e = Engine.__new__(Engine)
        e.load_renderers()

        self.assertIsInstance(e.renderers, dict)
        self.assertDictEqual(e.renderers, DefaultRenderers)
Ejemplo n.º 7
0
    def test_load_hooks_no_hooks(self):
        e = Engine.__new__(Engine)
        e.load_hooks()

        self.assertFalse(hasattr(e, 'hooks'))