OLD | NEW |
(Empty) | |
| 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 unittest |
| 7 |
| 8 from compiled_file_system_source import CompiledFileSystemSource as CFSSource |
| 9 |
| 10 class CompiledFileSystemSourceTest(unittest.TestCase): |
| 11 def testGet(self): |
| 12 class MockCFS: |
| 13 def GetFromFile(self, key): |
| 14 fs = { |
| 15 'key/one': 'contents-one', |
| 16 'key/two/three': 'contents-two' |
| 17 } |
| 18 |
| 19 return fs.get(key) |
| 20 |
| 21 source = CFSSource(MockCFS(), 'key', lambda key: key.lower()) |
| 22 |
| 23 self.assertEqual('contents-one', source.get('ONE')) |
| 24 self.assertEqual('contents-two', source.get('TwO/three')) |
| 25 |
| 26 if __name__ == '__main__': |
| 27 unittest.main() |
OLD | NEW |