Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: chrome/common/extensions/docs/server2/github_file_system_test.py

Issue 151883009: Docserver: Make MockFileSystem not iterate over the entire file system as part (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yoz and then some Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 json 6 import json
7 import os 7 import os
8 import sys 8 import sys
9 import unittest 9 import unittest
10 10
(...skipping 14 matching lines...) Expand all
25 def _ReadLocalFile(self, filename): 25 def _ReadLocalFile(self, filename):
26 with open(os.path.join(self._base_path, filename), 'r') as f: 26 with open(os.path.join(self._base_path, filename), 'r') as f:
27 return f.read() 27 return f.read()
28 28
29 def testList(self): 29 def testList(self):
30 self.assertEqual(json.loads(self._ReadLocalFile('expected_list.json')), 30 self.assertEqual(json.loads(self._ReadLocalFile('expected_list.json')),
31 self._file_system.Read(['/']).Get()) 31 self._file_system.Read(['/']).Get())
32 32
33 def testRead(self): 33 def testRead(self):
34 self.assertEqual(self._ReadLocalFile('expected_read.txt'), 34 self.assertEqual(self._ReadLocalFile('expected_read.txt'),
35 self._file_system.ReadSingle('/analytics/launch.js').Get()) 35 self._file_system.ReadSingle('analytics/launch.js').Get())
36 36
37 def testStat(self): 37 def testStat(self):
38 self.assertEqual(0, self._file_system.Stat('zipball').version) 38 self.assertEqual(0, self._file_system.Stat('zipball').version)
39 39
40 def testKeyGeneration(self): 40 def testKeyGeneration(self):
41 self.assertEqual(0, len(files.GetBlobKeys())) 41 self.assertEqual(0, len(files.GetBlobKeys()))
42 self._file_system.ReadSingle('/analytics/launch.js').Get() 42 self._file_system.ReadSingle('analytics/launch.js').Get()
43 self.assertEqual(1, len(files.GetBlobKeys())) 43 self.assertEqual(1, len(files.GetBlobKeys()))
44 self._file_system.ReadSingle('/analytics/main.css').Get() 44 self._file_system.ReadSingle('analytics/main.css').Get()
45 self.assertEqual(1, len(files.GetBlobKeys())) 45 self.assertEqual(1, len(files.GetBlobKeys()))
46 46
47 if __name__ == '__main__': 47 if __name__ == '__main__':
48 unittest.main() 48 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/github_file_system.py ('k') | chrome/common/extensions/docs/server2/mock_file_system.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698