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

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

Issue 14267024: Devserver: have a separate ObjectStore namespace (both memcache and datastore) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove _CheckVersions 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 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
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 def _ReadLocalFile(self, filename): 53 def _ReadLocalFile(self, filename):
54 with open(os.path.join(self._base_path, filename), 'r') as f: 54 with open(os.path.join(self._base_path, filename), 'r') as f:
55 return f.read() 55 return f.read()
56 56
57 def _CreateRefResolver(self, filename): 57 def _CreateRefResolver(self, filename):
58 data_source = FakeAPIAndListDataSource( 58 data_source = FakeAPIAndListDataSource(
59 self._LoadJSON(filename)) 59 self._LoadJSON(filename))
60 return ReferenceResolver.Factory(data_source, 60 return ReferenceResolver.Factory(data_source,
61 data_source, 61 data_source,
62 ObjectStoreCreator.Factory()).Create() 62 ObjectStoreCreator.TestFactory()).Create()
63 63
64 def _LoadJSON(self, filename): 64 def _LoadJSON(self, filename):
65 return json.loads(self._ReadLocalFile(filename)) 65 return json.loads(self._ReadLocalFile(filename))
66 66
67 def testCreateId(self): 67 def testCreateId(self):
68 data_source = FakeAPIAndListDataSource( 68 data_source = FakeAPIAndListDataSource(
69 self._LoadJSON('test_file_data_source.json')) 69 self._LoadJSON('test_file_data_source.json'))
70 dict_ = _JSCModel(self._LoadJSON('test_file.json')[0], 70 dict_ = _JSCModel(self._LoadJSON('test_file.json')[0],
71 self._CreateRefResolver('test_file_data_source.json'), 71 self._CreateRefResolver('test_file_data_source.json'),
72 False).ToDict() 72 False).ToDict()
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 _MakeLink('ref_test.html#type-type2', 'type2')), 107 _MakeLink('ref_test.html#type-type2', 'type2')),
108 _GetType(dict_, 'type3')['description']) 108 _GetType(dict_, 'type3')['description'])
109 109
110 def testRemoveNoDocs(self): 110 def testRemoveNoDocs(self):
111 d = self._LoadJSON('nodoc_test.json') 111 d = self._LoadJSON('nodoc_test.json')
112 _RemoveNoDocs(d) 112 _RemoveNoDocs(d)
113 self.assertEqual(self._LoadJSON('expected_nodoc.json'), d) 113 self.assertEqual(self._LoadJSON('expected_nodoc.json'), d)
114 114
115 if __name__ == '__main__': 115 if __name__ == '__main__':
116 unittest.main() 116 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698