| 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()
|
|
|