Chromium Code Reviews| 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 import test_urlfetch | 8 import test_urlfetch |
| 9 | 9 |
| 10 from subversion_fetcher import SubversionFetcher | 10 from subversion_fetcher import SubversionFetcher |
| 11 | 11 |
| 12 class TestSubversionFetcher(SubversionFetcher): | 12 class TestSubversionFetcher(SubversionFetcher): |
| 13 def _GetURLFromBranch(self, branch): | 13 def _GetURLFromBranch(self, branch): |
| 14 if branch == 'trunk': | 14 if branch == 'trunk': |
| 15 return os.path.join('subversion_fetcher', 'trunk') | 15 return os.path.join('subversion_fetcher', 'trunk') |
| 16 return os.path.join('subversion_fetcher', branch) | 16 return os.path.join('subversion_fetcher', branch) |
| 17 | 17 |
|
not at google - send to devlin
2012/07/12 07:06:29
tests for listing files?
cduvall
2012/07/12 18:09:02
Done.
| |
| 18 | |
| 19 class SubversionFetcherTest(unittest.TestCase): | 18 class SubversionFetcherTest(unittest.TestCase): |
| 20 def testFetchResource(self): | 19 def testFetchResource(self): |
| 21 fetcher_t = TestSubversionFetcher('trunk', '', test_urlfetch) | 20 fetcher_t = TestSubversionFetcher('trunk', '', test_urlfetch) |
| 22 fetcher_b1 = TestSubversionFetcher('branch1', '', test_urlfetch) | 21 fetcher_b1 = TestSubversionFetcher('branch1', '', test_urlfetch) |
| 23 fetcher_b2 = TestSubversionFetcher('branch2', '', test_urlfetch) | 22 fetcher_b2 = TestSubversionFetcher('branch2', '', test_urlfetch) |
| 24 self.assertEquals('trunk test\n', | 23 self.assertEquals('trunk test\n', |
| 25 fetcher_t.FetchResource('/test.txt').content) | 24 fetcher_t.FetchResource('/test.txt').content) |
| 26 self.assertEquals('branch1 test\n', | 25 self.assertEquals('branch1 test\n', |
| 27 fetcher_b1.FetchResource('/test.txt').content) | 26 fetcher_b1.FetchResource('/test.txt').content) |
| 28 self.assertEquals('branch2 test\n', | 27 self.assertEquals('branch2 test\n', |
| 29 fetcher_b2.FetchResource('/test.txt').content) | 28 fetcher_b2.FetchResource('/test.txt').content) |
| 30 | 29 |
| 31 if __name__ == '__main__': | 30 if __name__ == '__main__': |
| 32 unittest.main() | 31 unittest.main() |
| OLD | NEW |