Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/memcache_file_system_test.py |
| diff --git a/chrome/common/extensions/docs/server2/memcache_file_system_test.py b/chrome/common/extensions/docs/server2/memcache_file_system_test.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..c8f677b53bccfab131f1f9bf956c42a11506bf58 |
| --- /dev/null |
| +++ b/chrome/common/extensions/docs/server2/memcache_file_system_test.py |
| @@ -0,0 +1,45 @@ |
| +#!/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 os |
| +import unittest |
| + |
| +import appengine_memcache as memcache |
| +from in_memory_memcache import InMemoryMemcache |
| +from local_file_system import LocalFileSystem |
| +from memcache_file_system import MemcacheFileSystem |
| + |
| +class LocalFileSystemTest(unittest.TestCase): |
| + def setUp(self): |
| + self._file_system = MemcacheFileSystem( |
| + LocalFileSystem(os.path.join('test_data', 'file_system')), |
| + InMemoryMemcache()) |
| + |
| + def testReadFiles(self): |
| + expected = { |
| + 'test1.txt': 'test1\n', |
| + 'test2.txt': 'test2\n', |
| + 'test3.txt': 'test3\n', |
| + } |
| + self.assertEqual( |
| + expected, |
| + self._file_system.Read(['test1.txt', 'test2.txt', 'test3.txt']).Get()) |
| + |
| + def testListDir(self): |
| + expected = ['dir/'] |
| + for i in range(7): |
| + expected.append('file%d.html' % i) |
| + self.assertEqual( |
| + expected, |
| + sorted(self._file_system.Read(['list/']).Get()['list/'])) |
| + (self._file_system._memcache._cache[memcache.MEMCACHE_FILE_SYSTEM_READ] |
|
not at google - send to devlin
2012/07/19 03:55:19
Shoudn't need to access local variables like this.
cduvall
2012/07/19 17:18:28
Done.
|
| + ['list/'][0].remove('file0.html')) |
| + expected.remove('file0.html') |
| + self.assertEqual( |
| + expected, |
| + sorted(self._file_system.Read(['list/']).Get()['list/'])) |
| + |
|
not at google - send to devlin
2012/07/19 03:55:19
In any case, these tests don't really test the poi
cduvall
2012/07/19 17:18:28
Ok, sounds good.
|
| +if __name__ == '__main__': |
| + unittest.main() |