| 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 from copy import deepcopy | 6 from copy import deepcopy |
| 7 import json | 7 import json |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 from compiled_file_system import CompiledFileSystem | 10 from compiled_file_system import CompiledFileSystem |
| 11 import manifest_data_source | 11 import manifest_data_source |
| 12 from object_store_creator import ObjectStoreCreator | 12 from object_store_creator import ObjectStoreCreator |
| 13 from test_file_system import TestFileSystem | 13 from test_file_system import TestFileSystem |
| 14 | 14 |
| 15 |
| 15 convert_and_annotate_docs = { | 16 convert_and_annotate_docs = { |
| 16 'name': { | 17 'name': { |
| 17 'example': "My {{title}}", | 18 'example': "My {{title}}", |
| 18 'name': 'name', | 19 'name': 'name', |
| 19 'level': 'required' | 20 'level': 'required' |
| 20 }, | 21 }, |
| 21 'doc2': { | 22 'doc2': { |
| 22 'level': 'required', | 23 'level': 'required', |
| 23 'name': 'doc2' | 24 'name': 'doc2' |
| 24 }, | 25 }, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 48 'doc5': { | 49 'doc5': { |
| 49 'level': 'only_one', | 50 'level': 'only_one', |
| 50 'name': 'doc5' | 51 'name': 'doc5' |
| 51 }, | 52 }, |
| 52 'doc6': { | 53 'doc6': { |
| 53 'level': 'optional', | 54 'level': 'optional', |
| 54 'name': 'doc6' | 55 'name': 'doc6' |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 | 58 |
| 59 |
| 58 class ManifestDataSourceTest(unittest.TestCase): | 60 class ManifestDataSourceTest(unittest.TestCase): |
| 59 def testListifyAndSortDocs(self): | 61 def testListifyAndSortDocs(self): |
| 60 expected_docs = [ | 62 expected_docs = [ |
| 61 { | 63 { |
| 62 'level': 'required', | 64 'level': 'required', |
| 63 'name': 'doc1', | 65 'name': 'doc1', |
| 64 'children': [ | 66 'children': [ |
| 65 { | 67 { |
| 66 'level': 'required', | 68 'level': 'required', |
| 67 'name': 'sub2' | 69 'name': 'sub2' |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 ] | 250 ] |
| 249 | 251 |
| 250 class FakeServerInstance(object): | 252 class FakeServerInstance(object): |
| 251 def __init__(self): | 253 def __init__(self): |
| 252 self.host_file_system = file_system | 254 self.host_file_system = file_system |
| 253 self.compiled_host_fs_factory = CompiledFileSystem.Factory( | 255 self.compiled_host_fs_factory = CompiledFileSystem.Factory( |
| 254 file_system, ObjectStoreCreator.ForTest()) | 256 file_system, ObjectStoreCreator.ForTest()) |
| 255 self.manifest_json_path = 'manifest.json' | 257 self.manifest_json_path = 'manifest.json' |
| 256 self.manifest_features_path = '_manifest_features.json' | 258 self.manifest_features_path = '_manifest_features.json' |
| 257 | 259 |
| 258 mds = manifest_data_source.ManifestDataSource(FakeServerInstance()) | 260 mds = manifest_data_source.ManifestDataSource(FakeServerInstance(), None) |
| 259 self.maxDiff = None | |
| 260 self.assertEqual(expected_app, mds.get('apps')) | 261 self.assertEqual(expected_app, mds.get('apps')) |
| 261 | 262 |
| 262 if __name__ == '__main__': | 263 if __name__ == '__main__': |
| 263 unittest.main() | 264 unittest.main() |
| OLD | NEW |