~smoser/cloud-init/trunk.new-ds

« back to all changes in this revision

Viewing changes to tests/unittests/test_templating.py

  • Committer: Scott Moser
  • Date: 2015-02-11 01:53:20 UTC
  • mfrom: (1052.1.45 py2-3.smoser)
  • Revision ID: smoser@ubuntu.com-20150211015320-049dv6n1mk2in7l1
python3 support.

This gives us functional python3 support.  There are likely
still bugs, but instance boot on openstack is functional now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#    You should have received a copy of the GNU General Public License
17
17
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
18
 
 
19
from __future__ import print_function
 
20
 
 
21
import sys
 
22
import six
 
23
import unittest
 
24
 
19
25
from . import helpers as test_helpers
20
26
import textwrap
21
27
 
22
28
from cloudinit import templater
23
29
 
 
30
try:
 
31
    import Cheetah
 
32
    HAS_CHEETAH = True
 
33
except ImportError:
 
34
    HAS_CHEETAH = False
 
35
 
24
36
 
25
37
class TestTemplates(test_helpers.TestCase):
26
38
    def test_render_basic(self):
38
50
        out_data = templater.basic_render(in_data, {'b': 2})
39
51
        self.assertEqual(expected_data.strip(), out_data)
40
52
 
 
53
    @test_helpers.skipIf(not HAS_CHEETAH, 'cheetah renderer not available')
41
54
    def test_detection(self):
42
55
        blob = "## template:cheetah"
43
56