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

Unified Diff: chrome/common/extensions/docs/server2/api_data_source_test.py

Issue 14322003: Inline docs render properly in extensions doc server. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small test changes Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/docs/server2/api_data_source.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/server2/api_data_source_test.py
diff --git a/chrome/common/extensions/docs/server2/api_data_source_test.py b/chrome/common/extensions/docs/server2/api_data_source_test.py
index 5e935880a600ab9b85baee322912324ae8337c6a..d8ce485a644f9fb22852e48fc14d9a09247ef7f6 100755
--- a/chrome/common/extensions/docs/server2/api_data_source_test.py
+++ b/chrome/common/extensions/docs/server2/api_data_source_test.py
@@ -3,6 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import copy
import json
import os
import sys
@@ -11,13 +12,13 @@ import unittest
from api_data_source import (APIDataSource,
_JSCModel,
_FormatValue,
- _RemoveNoDocs)
+ _RemoveNoDocs,
+ _InlineDocs)
from compiled_file_system import CompiledFileSystem
from file_system import FileNotFoundError
from local_file_system import LocalFileSystem
from object_store_creator import ObjectStoreCreator
from reference_resolver import ReferenceResolver
-import third_party.json_schema_compiler.model as model
def _MakeLink(href, text):
return '<a href="%s">%s</a>' % (href, text)
@@ -112,5 +113,70 @@ class APIDataSourceTest(unittest.TestCase):
_RemoveNoDocs(d)
self.assertEqual(self._LoadJSON('expected_nodoc.json'), d)
+ def testInlineDocs(self):
+ schema = {
+ "namespace": "storage",
+ "properties": {
+ "key2": {
+ "description": "second key",
+ "$ref": "Key"
+ },
+ "key1": {
+ "description": "first key",
+ "$ref": "Key"
+ }
+ },
+ "types": [
+ {
+ "inline_doc": True,
+ "type": "string",
+ "id": "Key", # Should be inlined into both properties and be removed
+ # from types.
+ "description": "This is a key.", # This description should disappear.
+ "marker": True # This should appear three times in the output.
+ },
+ {
+ "items": {
+ "$ref": "Key"
+ },
+ "type": "array",
+ "id": "KeyList",
+ "description": "A list of keys"
+ }
+ ]
+ }
+
+ expected_schema = {
+ "namespace": "storage",
+ "properties": {
+ "key2": {
+ "marker": True,
+ "type": "string",
+ "description": "second key"
+ },
+ "key1": {
+ "marker": True,
+ "type": "string",
+ "description": "first key"
+ }
+ },
+ "types": [
+ {
+ "items": {
+ "marker": True,
+ "type": "string"
+ },
+ "type": "array",
+ "id": "KeyList",
+ "description": "A list of keys"
+ }
+ ]
+ }
+
+ inlined_schema = copy.deepcopy(schema)
+ _InlineDocs(inlined_schema)
+ self.assertEqual(expected_schema, inlined_schema)
+
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « chrome/common/extensions/docs/server2/api_data_source.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698