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

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

Issue 11195055: Extensions Docs Server: Fix handling of nodocs in server2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: increment APIDataSource version Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 sys 8 import sys
9 import unittest 9 import unittest
10 10
11 from api_data_source import APIDataSource, _JscModel, _FormatValue 11 from api_data_source import (APIDataSource,
12 _JscModel,
13 _FormatValue,
14 _RemoveNoDocs)
12 from compiled_file_system import CompiledFileSystem 15 from compiled_file_system import CompiledFileSystem
13 from docs_server_utils import GetLinkToRefType 16 from docs_server_utils import GetLinkToRefType
14 from file_system import FileNotFoundError 17 from file_system import FileNotFoundError
15 from in_memory_object_store import InMemoryObjectStore 18 from in_memory_object_store import InMemoryObjectStore
16 from local_file_system import LocalFileSystem 19 from local_file_system import LocalFileSystem
17 import third_party.json_schema_compiler.json_comment_eater as comment_eater 20 import third_party.json_schema_compiler.json_comment_eater as comment_eater
18 import third_party.json_schema_compiler.model as model 21 import third_party.json_schema_compiler.model as model
19 22
20 def _MakeLink(href, text): 23 def _MakeLink(href, text):
21 return '<a href="%s">%s</a>' % (href, text) 24 return '<a href="%s">%s</a>' % (href, text)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 _GetType(dict_, 'type1')['description']) 104 _GetType(dict_, 'type1')['description'])
102 self.assertEquals( 105 self.assertEquals(
103 'A %s, or %s' % (_MakeLink('#type-type3', 'type3'), 106 'A %s, or %s' % (_MakeLink('#type-type3', 'type3'),
104 _MakeLink('#type-type2', 'type2')), 107 _MakeLink('#type-type2', 'type2')),
105 _GetType(dict_, 'type2')['description']) 108 _GetType(dict_, 'type2')['description'])
106 self.assertEquals( 109 self.assertEquals(
107 '%s != %s' % (_MakeLink('other.html#type-type2', 'other.type2'), 110 '%s != %s' % (_MakeLink('other.html#type-type2', 'other.type2'),
108 _MakeLink('#type-type2', 'type2')), 111 _MakeLink('#type-type2', 'type2')),
109 _GetType(dict_, 'type3')['description']) 112 _GetType(dict_, 'type3')['description'])
110 113
114 def testRemoveNoDocs(self):
115 d = json.loads(self._ReadLocalFile('nodoc_test.json'))
116 _RemoveNoDocs(d)
117 self.assertEqual(json.loads(self._ReadLocalFile('expected_nodoc.json')), d)
118
111 if __name__ == '__main__': 119 if __name__ == '__main__':
112 unittest.main() 120 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698