| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 import os | |
| 7 import unittest | |
| 8 import test_urlfetch | |
| 9 | |
| 10 from template_utility import TemplateUtility | |
| 11 from third_party.handlebar import Handlebar | |
| 12 | |
| 13 def _ReadFile(filename): | |
| 14 with open(os.path.join('test_data', 'template_utility', filename), 'r') as f: | |
| 15 return f.read() | |
| 16 | |
| 17 class TemplateUtilityTest(unittest.TestCase): | |
| 18 def _RenderTest(self, base): | |
| 19 template = Handlebar(_ReadFile(base + '_tmpl.html')) | |
| 20 self.assertEquals(_ReadFile(base + '.html'), | |
| 21 self.t_util.RenderTemplate(template, _ReadFile(base + '.json'))) | |
| 22 | |
| 23 def testRenderTemplate(self): | |
| 24 self.t_util = TemplateUtility() | |
| 25 self._RenderTest('test1') | |
| 26 self._RenderTest('test2') | |
| 27 | |
| 28 if __name__ == '__main__': | |
| 29 unittest.main() | |
| OLD | NEW |