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

Unified 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: fixed templates 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/samples_data_source_test.py
diff --git a/chrome/common/extensions/docs/server2/samples_data_source_test.py b/chrome/common/extensions/docs/server2/samples_data_source_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..cfcbd1f2e9224c5afa6205a91e7cfdf4ddb81e5c
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/samples_data_source_test.py
@@ -0,0 +1,30 @@
+#!/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 samples_data_source import SamplesDataSource
+
+class SamplesDataSourceTest(unittest.TestCase):
+ def setUp(self):
+ self._base_path = os.path.join('test_data', 'samples_data_source')
+
+ def _ReadLocalFile(self, filename):
+ with open(os.path.join(self._base_path, filename), 'r') as f:
+ return f.read()
+
+ def _FakeGet(self, key):
+ return json.loads(self._ReadLocalFile(key))
+
+ def testFilterSamples(self):
+ sds = SamplesDataSource({}, {}, 'fake_path', None)
+ sds.get = self._FakeGet
+ self.assertEquals(json.loads(self._ReadLocalFile('expected.json')),
+ sds.FilterSamples('samples.json', 'bobaloo'))
+
+if __name__ == '__main__':
+ unittest.main()

Powered by Google App Engine
This is Rietveld 408576698