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

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

Issue 344453003: Docserver: separate models for apps and extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test to availability_finder_test.py Created 6 years, 6 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
(...skipping 21 matching lines...) Expand all
32 }, 32 },
33 # This won't appear for anything because it's private. 33 # This won't appear for anything because it's private.
34 'commandLinePrivate': { 34 'commandLinePrivate': {
35 'extension_types': ['platform_app', 'extension'] 35 'extension_types': ['platform_app', 'extension']
36 }, 36 },
37 # This will only appear for apps with an auto-generated description because 37 # This will only appear for apps with an auto-generated description because
38 # it's an API. 38 # it's an API.
39 'cookies': { 39 'cookies': {
40 'extension_types': ['platform_app'] 40 'extension_types': ['platform_app']
41 }, 41 },
42 'host-permissions': {}
42 } 43 }
43 44
44 45
45 _PERMISSIONS_JSON = { 46 _PERMISSIONS_JSON = {
46 # This will appear for both apps and extensions with a custom description, 47 # This will appear for both apps and extensions with a custom description,
47 # anchor, etc. 48 # anchor, etc.
48 'host-permissions': { 49 'host-permissions': {
49 'anchor': 'custom-anchor', 50 'anchor': 'custom-anchor',
50 'extension_types': ['platform_app', 'extension'], 51 'extension_types': ['platform_app', 'extension'],
51 'literal_name': True, 52 'literal_name': True,
(...skipping 25 matching lines...) Expand all
77 78
78 79
79 class PermissionsDataSourceTest(unittest.TestCase): 80 class PermissionsDataSourceTest(unittest.TestCase):
80 def testCreatePermissionsDataSource(self): 81 def testCreatePermissionsDataSource(self):
81 expected_extensions = [ 82 expected_extensions = [
82 { 83 {
83 'anchor': 'custom-anchor', 84 'anchor': 'custom-anchor',
84 'description': 'host permissions', 85 'description': 'host permissions',
85 'literal_name': True, 86 'literal_name': True,
86 'name': 'match pattern', 87 'name': 'match pattern',
87 'platforms': ['apps', 'extensions'] 88 'channel': 'stable'
88 }, 89 },
89 { 90 {
90 'anchor': 'activeTab', 91 'anchor': 'activeTab',
91 'description': 'active tab', 92 'description': 'active tab',
92 'name': 'activeTab', 93 'name': 'activeTab',
93 'platforms': ['extensions'], 94 'channel': 'stable'
94 }, 95 },
95 { 96 {
96 'anchor': 'alarms', 97 'anchor': 'alarms',
97 'description': 'generic description', 98 'description': 'generic description',
98 'name': 'alarms', 99 'name': 'alarms',
99 'platforms': ['apps', 'extensions'], 100 'channel': 'stable'
100 }, 101 },
101 ] 102 ]
102 103
103 expected_apps = [ 104 expected_apps = [
104 { 105 {
105 'anchor': 'custom-anchor', 106 'anchor': 'custom-anchor',
106 'description': 'host permissions', 107 'description': 'host permissions',
107 'literal_name': True, 108 'literal_name': True,
108 'name': 'match pattern', 109 'name': 'match pattern',
109 'platforms': ['apps', 'extensions'], 110 'channel': 'stable'
110 }, 111 },
111 { 112 {
112 'anchor': 'alarms', 113 'anchor': 'alarms',
113 'description': 'generic description', 114 'description': 'generic description',
114 'name': 'alarms', 115 'name': 'alarms',
115 'platforms': ['apps', 'extensions'], 116 'channel': 'stable'
116 }, 117 },
117 { 118 {
118 'anchor': 'cookies', 119 'anchor': 'cookies',
119 'description': 'generic description', 120 'description': 'generic description',
120 'name': 'cookies', 121 'name': 'cookies',
121 'platforms': ['apps'], 122 'channel': 'stable'
122 }, 123 },
123 ] 124 ]
124 125
125 test_file_system = TestFileSystem({ 126 test_file_system = TestFileSystem({
126 'api': { 127 'api': {
127 '_api_features.json': json.dumps(_API_FEATURES), 128 '_api_features.json': json.dumps(_API_FEATURES),
128 '_manifest_features.json': '{}', 129 '_manifest_features.json': '{}',
129 '_permission_features.json': json.dumps(_PERMISSION_FEATURES), 130 '_permission_features.json': json.dumps(_PERMISSION_FEATURES),
130 }, 131 },
131 'docs': { 132 'docs': {
(...skipping 27 matching lines...) Expand all
159 for key, value in mapping.iteritems(): 160 for key, value in mapping.iteritems():
160 if isinstance(value, Handlebar): 161 if isinstance(value, Handlebar):
161 mapping[key] = value.Render().text 162 mapping[key] = value.Render().text
162 163
163 self.assertEqual(expected_extensions, actual_extensions) 164 self.assertEqual(expected_extensions, actual_extensions)
164 self.assertEqual(expected_apps, actual_apps) 165 self.assertEqual(expected_apps, actual_apps)
165 166
166 167
167 if __name__ == '__main__': 168 if __name__ == '__main__':
168 unittest.main() 169 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698