| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 unittest | 7 import unittest |
| 8 | 8 |
| 9 from compiled_file_system import CompiledFileSystem | 9 from compiled_file_system import CompiledFileSystem |
| 10 from mock_file_system import MockFileSystem | 10 from mock_file_system import MockFileSystem |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 def testCron(self): | 145 def testCron(self): |
| 146 file_system = TestFileSystem({ | 146 file_system = TestFileSystem({ |
| 147 'apps_sidenav.json': '[{ "title": "H1" }]' , | 147 'apps_sidenav.json': '[{ "title": "H1" }]' , |
| 148 'extensions_sidenav.json': '[{ "title": "H2" }]' | 148 'extensions_sidenav.json': '[{ "title": "H2" }]' |
| 149 }, relative_to='docs/templates/json') | 149 }, relative_to='docs/templates/json') |
| 150 | 150 |
| 151 # Ensure Cron doesn't rely on request. | 151 # Ensure Cron doesn't rely on request. |
| 152 sidenav_data_source = SidenavDataSource( | 152 sidenav_data_source = SidenavDataSource( |
| 153 ServerInstance.ForTest(file_system), request=None) | 153 ServerInstance.ForTest(file_system), request=None) |
| 154 sidenav_data_source.Cron() | 154 sidenav_data_source.Cron().Get() |
| 155 | 155 |
| 156 # If Cron fails, apps_sidenav.json will not be cached, and the _cache_data | 156 # If Cron fails, apps_sidenav.json will not be cached, and the _cache_data |
| 157 # access will fail. | 157 # access will fail. |
| 158 # TODO(jshumway): Make a non hack version of this check. | 158 # TODO(jshumway): Make a non hack version of this check. |
| 159 sidenav_data_source._cache._file_object_store.Get( | 159 sidenav_data_source._cache._file_object_store.Get( |
| 160 'docs/templates/json/apps_sidenav.json').Get()._cache_data | 160 'docs/templates/json/apps_sidenav.json').Get()._cache_data |
| 161 | 161 |
| 162 | 162 |
| 163 if __name__ == '__main__': | 163 if __name__ == '__main__': |
| 164 unittest.main() | 164 unittest.main() |
| OLD | NEW |