| Index: chrome/common/extensions/docs/server2/template_utility_test.py
|
| diff --git a/chrome/common/extensions/docs/server2/template_utility_test.py b/chrome/common/extensions/docs/server2/template_utility_test.py
|
| new file mode 100755
|
| index 0000000000000000000000000000000000000000..0af8259fbff6b4e2152302b9a94652e8d7c44615
|
| --- /dev/null
|
| +++ b/chrome/common/extensions/docs/server2/template_utility_test.py
|
| @@ -0,0 +1,29 @@
|
| +#!/usr/bin/env python
|
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +import os
|
| +import unittest
|
| +import test_urlfetch
|
| +
|
| +from template_utility import TemplateUtility
|
| +from third_party.handlebar import Handlebar
|
| +
|
| +def _ReadFile(filename):
|
| + with open(os.path.join('test_data', 'template_utility', filename), 'r') as f:
|
| + return f.read()
|
| +
|
| +class TemplateUtilityTest(unittest.TestCase):
|
| + def _RenderTest(self, base):
|
| + template = Handlebar(_ReadFile(base + '.tmpl'))
|
| + self.assertEquals(_ReadFile(base + '.html'),
|
| + self.t_util.RenderTemplate(template, _ReadFile(base + '.json')))
|
| +
|
| + def testRenderTemplate(self):
|
| + self.t_util = TemplateUtility()
|
| + self._RenderTest('test1')
|
| + self._RenderTest('test2')
|
| +
|
| +if __name__ == '__main__':
|
| + unittest.main()
|
|
|