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

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

Issue 10825067: Extensions Docs Server: Apps samples page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: less is_apps and fixes Created 8 years, 4 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
(Empty)
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
5
6 import json
7 import os
8 import unittest
9
10 from samples_data_source import SamplesDataSource
11
12 class SamplesDataSourceTest(unittest.TestCase):
13 def setUp(self):
14 self._base_path = os.path.join('test_data', 'samples_data_source')
15
16 def _ReadLocalFile(self, filename):
17 with open(os.path.join(self._base_path, filename), 'r') as f:
18 return f.read()
19
20 def _FakeGet(self, key):
21 return json.loads(self._ReadLocalFile(key))
22
23 def testFilterSamples(self):
24 sds = SamplesDataSource({}, {}, 'fake_path', None)
25 sds.get = self._FakeGet
26 self.assertEquals(json.loads(self._ReadLocalFile('expected.json')),
27 sds.FilterSamples('samples.json', 'bobaloo'))
28
29 if __name__ == '__main__':
30 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698