OLD | NEW |
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 os | 6 import os |
7 import unittest | 7 import unittest |
8 | 8 |
9 import appengine_memcache as memcache | 9 import appengine_memcache as memcache |
10 from in_memory_memcache import InMemoryMemcache | 10 from in_memory_memcache import InMemoryMemcache |
(...skipping 14 matching lines...) Expand all Loading... |
25 'test3.txt': 'test3\n', | 25 'test3.txt': 'test3\n', |
26 } | 26 } |
27 self.assertEqual( | 27 self.assertEqual( |
28 expected, | 28 expected, |
29 self._file_system.Read(['test1.txt', 'test2.txt', 'test3.txt']).Get()) | 29 self._file_system.Read(['test1.txt', 'test2.txt', 'test3.txt']).Get()) |
30 | 30 |
31 def testListDir(self): | 31 def testListDir(self): |
32 expected = ['dir/'] | 32 expected = ['dir/'] |
33 for i in range(7): | 33 for i in range(7): |
34 expected.append('file%d.html' % i) | 34 expected.append('file%d.html' % i) |
35 self.assertEqual( | 35 self.assertEqual(expected, |
36 expected, | 36 sorted(self._file_system.ReadSingleFile('list/'))) |
37 sorted(self._file_system.Read(['list/']).Get()['list/'])) | |
38 expected.remove('file0.html') | 37 expected.remove('file0.html') |
39 self._memcache.Set('list/', | 38 self._memcache.Set('list/', |
40 (expected, 0), | 39 (expected, 0), |
41 memcache.MEMCACHE_FILE_SYSTEM_READ) | 40 memcache.MEMCACHE_FILE_SYSTEM_READ) |
42 self.assertEqual( | 41 self.assertEqual(expected, |
43 expected, | 42 sorted(self._file_system.ReadSingleFile('list/'))) |
44 sorted(self._file_system.Read(['list/']).Get()['list/'])) | |
45 | 43 |
46 if __name__ == '__main__': | 44 if __name__ == '__main__': |
47 unittest.main() | 45 unittest.main() |
OLD | NEW |