- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / server2 / local_file_system_test.py
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 os
7 import sys
8 import unittest
9
10 from local_file_system import LocalFileSystem
11
12 class LocalFileSystemTest(unittest.TestCase):
13   def setUp(self):
14     self._file_system = LocalFileSystem(os.path.join(sys.path[0],
15                                                      'test_data',
16                                                      'file_system'))
17
18   def testReadFiles(self):
19     expected = {
20       'test1.txt': 'test1\n',
21       'test2.txt': 'test2\n',
22       'test3.txt': 'test3\n',
23     }
24     self.assertEqual(
25         expected,
26         self._file_system.Read(['test1.txt', 'test2.txt', 'test3.txt']).Get())
27
28   def testListDir(self):
29     expected = ['dir/']
30     for i in range(7):
31       expected.append('file%d.html' % i)
32     self.assertEqual(expected,
33                      sorted(self._file_system.ReadSingle('list/').Get()))
34
35 if __name__ == '__main__':
36   unittest.main()