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

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

Issue 10577022: Extensions Docs Server: HandlebarDictGenerator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/dict_generator_test.py
diff --git a/chrome/common/extensions/docs/server2/dict_generator_test.py b/chrome/common/extensions/docs/server2/dict_generator_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..d997f404cefce8a6aac92672c8a92fd58b8b2181
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/dict_generator_test.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import json
+import os
+import unittest
+
+from dict_generator import DictGenerator
+import third_party.json_schema_compiler.json_comment_eater as comment_eater
+import third_party.json_schema_compiler.model as model
+
+class DictGeneratorTest(unittest.TestCase):
+ def setUp(self):
+ self._base_path = os.path.join('test_data', 'dict_generator')
+
+ def _ReadLocalFile(self, filename):
+ with open(os.path.join(self._base_path, filename), 'r') as f:
+ return f.read()
+
+ def _GenerateTest(self, filename):
+ expected_json = json.loads(self._ReadLocalFile('expected_' + filename))
+ gen = DictGenerator(
+ json.loads(comment_eater.Nom(self._ReadLocalFile(filename)))[0])
+ self.assertEquals(expected_json, gen.Generate())
+
+
not at google - send to devlin 2012/06/19 20:33:10 extra \n ?
cduvall 2012/06/19 22:21:02 Done.
+ def testGenerate(self):
+ self._GenerateTest('bookmarks.json')
+ self._GenerateTest('browser_action.json')
+
+if __name__ == '__main__':
+ unittest.main()

Powered by Google App Engine
This is Rietveld 408576698