summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/server2/template_renderer_test.py
blob: 986b877cb8ccac707c6a735a230ba9b1413d0074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
# Copyright 2013 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 unittest

from server_instance import ServerInstance
from third_party.handlebar import Handlebar


class TemplateRendererTest(unittest.TestCase):
  '''Basic test for TemplateRenderer.

  When the DataSourceRegistry conversion is finished then we could do some more
  meaningful tests by injecting a different set of DataSources.
  '''

  def setUp(self):
    self._template_renderer = ServerInstance.ForLocal().template_renderer

  def testSimpleWiring(self):
    template = Handlebar('hello {{?true}}{{strings.extension}}{{/}}')
    text, warnings = self._template_renderer.Render(template, None)
    self.assertEqual('hello extension', text)
    self.assertEqual([], warnings)


if __name__ == '__main__':
  unittest.main()