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

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

Issue 15009006: Docserver: refactor Servlet, ObjectStore, and ServerInstance architecture to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cduvall, redirect fix Created 7 years, 7 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 | 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 copy 6 import copy
7 import json 7 import json
8 import os 8 import os
9 import sys 9 import sys
10 import unittest 10 import unittest
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 def _ReadLocalFile(self, filename): 54 def _ReadLocalFile(self, filename):
55 with open(os.path.join(self._base_path, filename), 'r') as f: 55 with open(os.path.join(self._base_path, filename), 'r') as f:
56 return f.read() 56 return f.read()
57 57
58 def _CreateRefResolver(self, filename): 58 def _CreateRefResolver(self, filename):
59 data_source = FakeAPIAndListDataSource( 59 data_source = FakeAPIAndListDataSource(
60 self._LoadJSON(filename)) 60 self._LoadJSON(filename))
61 return ReferenceResolver.Factory(data_source, 61 return ReferenceResolver.Factory(data_source,
62 data_source, 62 data_source,
63 ObjectStoreCreator.TestFactory()).Create() 63 ObjectStoreCreator.ForTest()).Create()
64 64
65 def _LoadJSON(self, filename): 65 def _LoadJSON(self, filename):
66 return json.loads(self._ReadLocalFile(filename)) 66 return json.loads(self._ReadLocalFile(filename))
67 67
68 def testCreateId(self): 68 def testCreateId(self):
69 data_source = FakeAPIAndListDataSource( 69 data_source = FakeAPIAndListDataSource(
70 self._LoadJSON('test_file_data_source.json')) 70 self._LoadJSON('test_file_data_source.json'))
71 dict_ = _JSCModel(self._LoadJSON('test_file.json')[0], 71 dict_ = _JSCModel(self._LoadJSON('test_file.json')[0],
72 self._CreateRefResolver('test_file_data_source.json'), 72 self._CreateRefResolver('test_file_data_source.json'),
73 False).ToDict() 73 False).ToDict()
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 ] 173 ]
174 } 174 }
175 175
176 inlined_schema = copy.deepcopy(schema) 176 inlined_schema = copy.deepcopy(schema)
177 _InlineDocs(inlined_schema) 177 _InlineDocs(inlined_schema)
178 self.assertEqual(expected_schema, inlined_schema) 178 self.assertEqual(expected_schema, inlined_schema)
179 179
180 180
181 if __name__ == '__main__': 181 if __name__ == '__main__':
182 unittest.main() 182 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698