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
4 # found in the LICENSE file.
8 from empty_dir_file_system
import EmptyDirFileSystem
9 from host_file_system_provider
import HostFileSystemProvider
10 from servlet
import Request
11 from test_branch_utility
import TestBranchUtility
12 from fail_on_access_file_system
import FailOnAccessFileSystem
13 from test_servlet
import TestServlet
15 class _TestDelegate(object):
16 def CreateBranchUtility(self
, object_store_creator
):
17 return TestBranchUtility
.CreateWithCannedData()
19 def CreateAppSamplesFileSystem(self
, object_store_creator
):
20 return EmptyDirFileSystem()
22 def CreateHostFileSystemProvider(self
, object_store_creator
):
23 return HostFileSystemProvider
.ForTest(
24 FailOnAccessFileSystem(), object_store_creator
)
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
28 # their respective modules. The only testable behavior TestServlet adds is
29 # returning a 404 if a test does not exist.
30 class TestServletTest(unittest
.TestCase
):
31 def testTestServlet(self
):
32 request
= Request('not_a_real_test_url', 'localhost', {})
33 test_servlet
= TestServlet(request
, _TestDelegate())
34 response
= test_servlet
.Get()
36 self
.assertEqual(404, response
.status
)
38 if __name__
== '__main__':