| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import json | 6 import json |
| 7 import os | 7 import os |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 from fetcher_cache import FetcherCache | 10 from fetcher_cache import FetcherCache |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 t_data_source['test2'].render({}, {'templates': {}}).text) | 43 t_data_source['test2'].render({}, {'templates': {}}).text) |
| 44 | 44 |
| 45 self.assertEqual(None, t_data_source['junk.html']) | 45 self.assertEqual(None, t_data_source['junk.html']) |
| 46 | 46 |
| 47 def testPartials(self): | 47 def testPartials(self): |
| 48 self._base_path = os.path.join(self._base_path, 'partials') | 48 self._base_path = os.path.join(self._base_path, 'partials') |
| 49 fetcher = LocalFetcher(self._base_path) | 49 fetcher = LocalFetcher(self._base_path) |
| 50 cache_builder = FetcherCache.Builder(fetcher, 0) | 50 cache_builder = FetcherCache.Builder(fetcher, 0) |
| 51 t_data_source = TemplateDataSource('fake_branch', cache_builder, ['./']) | 51 t_data_source = TemplateDataSource('fake_branch', cache_builder, ['./']) |
| 52 | 52 |
| 53 self.assertEqual(self._ReadLocalFile('test.html'), | 53 self.assertEqual(self._ReadLocalFile('test_expected.html'), |
| 54 t_data_source['test_tmpl'].render( | 54 t_data_source['test_tmpl'].render( |
| 55 json.loads(self._ReadLocalFile('input.json')), t_data_source).text) | 55 json.loads(self._ReadLocalFile('input.json')), t_data_source).text) |
| 56 | 56 |
| 57 def testRender(self): | 57 def testRender(self): |
| 58 self._base_path = os.path.join(self._base_path, 'render') | 58 self._base_path = os.path.join(self._base_path, 'render') |
| 59 fetcher = LocalFetcher(self._base_path) | 59 fetcher = LocalFetcher(self._base_path) |
| 60 cache_builder = FetcherCache.Builder(fetcher, 0) | 60 cache_builder = FetcherCache.Builder(fetcher, 0) |
| 61 t_data_source = TemplateDataSource('fake_branch', cache_builder, ['./']) | 61 t_data_source = TemplateDataSource('fake_branch', cache_builder, ['./']) |
| 62 self._RenderTest('test1', t_data_source) | 62 self._RenderTest('test1', t_data_source) |
| 63 self._RenderTest('test2', t_data_source) | 63 self._RenderTest('test2', t_data_source) |
| 64 | 64 |
| 65 | 65 |
| 66 | 66 |
| 67 if __name__ == '__main__': | 67 if __name__ == '__main__': |
| 68 unittest.main() | 68 unittest.main() |
| OLD | NEW |