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

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

Issue 14273041: Doc server manifest page generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: chrome/common/extensions/docs/server2/template_data_source_test.py
diff --git a/chrome/common/extensions/docs/server2/template_data_source_test.py b/chrome/common/extensions/docs/server2/template_data_source_test.py
index 9a5d438725d00b406b1f919829abfd619d6385d6..146ffc8b50667024526a4b5703703245a5930cf2 100755
--- a/chrome/common/extensions/docs/server2/template_data_source_test.py
+++ b/chrome/common/extensions/docs/server2/template_data_source_test.py
@@ -11,8 +11,10 @@ import unittest
from api_data_source import APIDataSource
from compiled_file_system import CompiledFileSystem
from local_file_system import LocalFileSystem
+from local_renderer import LocalRenderer
from object_store_creator import ObjectStoreCreator
from reference_resolver import ReferenceResolver
+import svn_constants
from template_data_source import TemplateDataSource
from test_util import DisableLogging
from third_party.handlebar import Handlebar
@@ -134,5 +136,40 @@ class TemplateDataSourceTest(unittest.TestCase):
compiled_fs_factory,
api_data=json.loads(self._ReadLocalFile('test2.json'))))
+ def testJSONDocumentationSources(self):
not at google - send to devlin 2013/04/30 16:21:09 We should just fix https://code.google.com/p/chrom
jshumway 2013/05/03 03:44:39 Good point, I have been noticing a lot of comments
+ # Make sure all of the documentation links in
+ # templates/json/(extensions|apps)_manifest.json can be rendered. This
+ # includes the template lookup through compiled_file_system_source.
+ from handler import Handler
+ _base_path = os.path.join(os.path.abspath(
+ os.path.dirname(__file__)), os.pardir, os.pardir, os.pardir)
+ renderer = LocalRenderer(_base_path)
+
+ for f in ['extensions', 'apps']:
+ json_path = os.path.join(
+ _base_path, 'extensions', svn_constants.JSON_PATH, f + '_manifest.json')
+ # If the json is malformed, this well raise an error.
+ with open(json_path) as jsonfile:
+ data = json.loads(jsonfile.read())
+
+ for section in data.keys():
+ for entry in data[section]:
+ link = entry['documentation']
+
+ # This doesn't work, apparently it doesn't create a true file_system,
+ # and therefore cannot render templates. Looking for a fix.
+ # _, render_status, __ = renderer.Render("/%s/%s" % (f, link))
+ # assertEqual(200, render_status)
+
+ # For now, just check if the public templates exist.
+ try:
+ path = os.path.join(
+ _base_path, 'extensions', svn_constants.PUBLIC_TEMPLATE_PATH, f)
+ os.stat(os.path.join(path, link))
+ except OSError:
+ raise OSError("A required template %s could not be found "
+ "in %s." % (link, path))
+
+
if __name__ == '__main__':
unittest.main()

Powered by Google App Engine
This is Rietveld 408576698