cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chrome / common / extensions / docs / server2 / github_file_system_test.py
blobdc6b36a836f21baaee93942173988a4965732c46
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.
6 import json
7 import os
8 import sys
9 import unittest
11 from appengine_wrappers import files
12 from fake_fetchers import ConfigureFakeFetchers
13 from github_file_system import GithubFileSystem
14 from object_store_creator import ObjectStoreCreator
15 from test_util import Server2Path
18 class GithubFileSystemTest(unittest.TestCase):
19 def setUp(self):
20 ConfigureFakeFetchers()
21 self._base_path = Server2Path('test_data', 'github_file_system')
22 self._file_system = GithubFileSystem.CreateChromeAppsSamples(
23 ObjectStoreCreator.ForTest())
25 def _ReadLocalFile(self, filename):
26 with open(os.path.join(self._base_path, filename), 'r') as f:
27 return f.read()
29 def testList(self):
30 self.assertEqual(json.loads(self._ReadLocalFile('expected_list.json')),
31 self._file_system.Read(['']).Get())
33 def testRead(self):
34 self.assertEqual(self._ReadLocalFile('expected_read.txt'),
35 self._file_system.ReadSingle('analytics/launch.js').Get())
37 def testStat(self):
38 self.assertEqual(0, self._file_system.Stat('zipball').version)
40 def testKeyGeneration(self):
41 self.assertEqual(0, len(files.GetBlobKeys()))
42 self._file_system.ReadSingle('analytics/launch.js').Get()
43 self.assertEqual(1, len(files.GetBlobKeys()))
44 self._file_system.ReadSingle('analytics/main.css').Get()
45 self.assertEqual(1, len(files.GetBlobKeys()))
47 if __name__ == '__main__':
48 unittest.main()