# -*- coding: utf-8; -*- import os from unittest import TestCase from unittest.mock import MagicMock from wuttamess import util as mod class TestExists(TestCase): def test_basic(self): c = MagicMock() mod.exists(c, '/foo') c.run.assert_called_once_with('test -e /foo', warn=True) class TestMakoRenderer(TestCase): def test_basic(self): c = MagicMock() renderer = mod.mako_renderer(c, env={'machine_is_live': True}) here = os.path.dirname(__file__) path = os.path.join(here, 'files', 'bar', 'baz') rendered = renderer(path, vars={}) self.assertEqual(rendered, 'machine_is_live = True')