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 from local_fetcher import LocalFetcher | 9 from local_fetcher import LocalFetcher |
10 | 10 |
11 class LocalFetcherTest(unittest.TestCase): | 11 class LocalFetcherTest(unittest.TestCase): |
12 def testFetchResource(self): | 12 def testFetchResource(self): |
13 fetcher = LocalFetcher('') | 13 fetcher = LocalFetcher('') |
14 local_path = os.path.join('test_data', 'local_fetcher') | 14 local_path = os.path.join('test_data', 'local_fetcher') |
15 self.assertEquals('test1\n', fetcher.FetchResource('', | 15 self.assertEquals('test1\n', fetcher.FetchResource( |
16 os.path.join(local_path, 'test1.txt')).content) | 16 os.path.join(local_path, 'test1.txt')).content) |
17 self.assertEquals('test2\n', fetcher.FetchResource('', | 17 self.assertEquals('test2\n', fetcher.FetchResource( |
18 os.path.join(local_path, 'test2.txt')).content) | 18 os.path.join(local_path, 'test2.txt')).content) |
19 self.assertEquals('test3\n', fetcher.FetchResource('junk', | 19 self.assertEquals('test3\n', fetcher.FetchResource( |
20 os.path.join(local_path, 'test3.txt')).content) | 20 os.path.join(local_path, 'test3.txt')).content) |
21 | 21 |
22 if __name__ == '__main__': | 22 if __name__ == '__main__': |
23 unittest.main() | 23 unittest.main() |
OLD | NEW |