OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 unittest | 6 import unittest |
7 | 7 |
8 from empty_dir_file_system import EmptyDirFileSystem | 8 from empty_dir_file_system import EmptyDirFileSystem |
9 from host_file_system_creator import HostFileSystemCreator | 9 from host_file_system_provider import HostFileSystemProvider |
10 from servlet import Request | 10 from servlet import Request |
11 from test_branch_utility import TestBranchUtility | 11 from test_branch_utility import TestBranchUtility |
12 from fail_on_access_file_system import FailOnAccessFileSystem | 12 from fail_on_access_file_system import FailOnAccessFileSystem |
13 from test_servlet import TestServlet | 13 from test_servlet import TestServlet |
14 | 14 |
15 class _TestDelegate(object): | 15 class _TestDelegate(object): |
16 def CreateBranchUtility(self, object_store_creator): | 16 def CreateBranchUtility(self, object_store_creator): |
17 return TestBranchUtility.CreateWithCannedData() | 17 return TestBranchUtility.CreateWithCannedData() |
18 | 18 |
19 def CreateAppSamplesFileSystem(self, object_store_creator): | 19 def CreateAppSamplesFileSystem(self, object_store_creator): |
20 return EmptyDirFileSystem() | 20 return EmptyDirFileSystem() |
21 | 21 |
22 def CreateHostFileSystemCreator(self, object_store_creator): | 22 def CreateHostFileSystemProvider(self, object_store_creator): |
23 return HostFileSystemCreator.ForTest( | 23 return HostFileSystemProvider.ForTest( |
24 FailOnAccessFileSystem(), object_store_creator) | 24 FailOnAccessFileSystem(), object_store_creator) |
25 | 25 |
26 # This test can't really be useful. The set of valid tests is changing and | 26 # This test can't really be useful. The set of valid tests is changing and |
27 # there is no reason to test the tests themselves, they are already tested in | 27 # there is no reason to test the tests themselves, they are already tested in |
28 # their respective modules. The only testable behavior TestServlet adds is | 28 # their respective modules. The only testable behavior TestServlet adds is |
29 # returning a 404 if a test does not exist. | 29 # returning a 404 if a test does not exist. |
30 class TestServletTest(unittest.TestCase): | 30 class TestServletTest(unittest.TestCase): |
31 def testTestServlet(self): | 31 def testTestServlet(self): |
32 request = Request('not_a_real_test_url', 'localhost', {}) | 32 request = Request('not_a_real_test_url', 'localhost', {}) |
33 test_servlet = TestServlet(request, _TestDelegate()) | 33 test_servlet = TestServlet(request, _TestDelegate()) |
34 response = test_servlet.Get() | 34 response = test_servlet.Get() |
35 | 35 |
36 self.assertEqual(404, response.status) | 36 self.assertEqual(404, response.status) |
37 | 37 |
38 if __name__ == '__main__': | 38 if __name__ == '__main__': |
39 unittest.main() | 39 unittest.main() |
OLD | NEW |