Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(866)

Side by Side Diff: chrome/common/extensions/docs/server2/permissions_data_source_test.py

Issue 498813002: Rename the docserver third_party dependency "handlebar" to "motemplate", as part (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: imports Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 from operator import itemgetter 7 from operator import itemgetter
8 import unittest 8 import unittest
9 9
10 from extensions_paths import CHROME_EXTENSIONS 10 from extensions_paths import CHROME_EXTENSIONS
11 from permissions_data_source import PermissionsDataSource 11 from permissions_data_source import PermissionsDataSource
12 from server_instance import ServerInstance 12 from server_instance import ServerInstance
13 from third_party.handlebar import Handlebar 13 from third_party.motemplate import Motemplate
14 from test_file_system import TestFileSystem 14 from test_file_system import TestFileSystem
15 15
16 16
17 _PERMISSION_FEATURES = { 17 _PERMISSION_FEATURES = {
18 # This will appear for extensions with a description as defined in the 18 # This will appear for extensions with a description as defined in the
19 # permissions.json file. 19 # permissions.json file.
20 'activeTab': { 20 'activeTab': {
21 'extension_types': ['extension'], 21 'extension_types': ['extension'],
22 }, 22 },
23 # This will appear for apps and extensions with an auto-generated description 23 # This will appear for apps and extensions with an auto-generated description
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 permissions_data_source = PermissionsDataSource( 151 permissions_data_source = PermissionsDataSource(
152 ServerInstance.ForTest(test_file_system), None) 152 ServerInstance.ForTest(test_file_system), None)
153 153
154 actual_extensions = permissions_data_source.get('declare_extensions') 154 actual_extensions = permissions_data_source.get('declare_extensions')
155 actual_apps = permissions_data_source.get('declare_apps') 155 actual_apps = permissions_data_source.get('declare_apps')
156 156
157 # Normalise all test data. 157 # Normalise all test data.
158 # - Sort keys. Since the tests don't use OrderedDicts we can't make 158 # - Sort keys. Since the tests don't use OrderedDicts we can't make
159 # assertions about the order, which is unfortunate. Oh well. 159 # assertions about the order, which is unfortunate. Oh well.
160 # - Render all of the Handlerbar instances so that we can use ==. 160 # - Render all of the Handlerbar instances so that we can use ==.
161 # Handlebars don't implement __eq__, but they probably should. 161 # Motemplates don't implement __eq__, but they probably should.
162 for lst in (actual_apps, actual_extensions, 162 for lst in (actual_apps, actual_extensions,
163 expected_apps, expected_extensions): 163 expected_apps, expected_extensions):
164 lst.sort(key=itemgetter('name')) 164 lst.sort(key=itemgetter('name'))
165 for mapping in lst: 165 for mapping in lst:
166 for key, value in mapping.iteritems(): 166 for key, value in mapping.iteritems():
167 if isinstance(value, Handlebar): 167 if isinstance(value, Motemplate):
168 mapping[key] = value.Render().text 168 mapping[key] = value.Render().text
169 169
170 self.assertEqual(expected_extensions, actual_extensions) 170 self.assertEqual(expected_extensions, actual_extensions)
171 self.assertEqual(expected_apps, actual_apps) 171 self.assertEqual(expected_apps, actual_apps)
172 172
173 173
174 if __name__ == '__main__': 174 if __name__ == '__main__':
175 unittest.main() 175 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/jsc_view_test.py ('k') | chrome/common/extensions/docs/server2/render_servlet.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698