1
# Copyright (C) 2005, 2006 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
"""Transport implementation that disables listing to simulate HTTP cheaply."""
19
import bzrlib.errors as errors
20
from bzrlib.transport import Transport
21
from bzrlib.transport.decorator import TransportDecorator, DecoratorServer
24
class UnlistableTransportDecorator(TransportDecorator):
25
"""A transport that disables file listing for testing."""
28
def _get_url_prefix(self):
29
"""Unlistable transports are identified by 'unlistable+'"""
32
def iter_files_recursive(self):
33
Transport.iter_files_recursive(self)
38
def list_dir(self, relpath):
39
Transport.list_dir(self, relpath)
42
class UnlistableServer(DecoratorServer):
43
"""Server for the UnlistableTransportDecorator for testing with."""
45
def get_decorator_class(self):
46
return UnlistableTransportDecorator
49
def get_test_permutations():
50
"""Return the permutations to be used in testing."""
51
return [(UnlistableTransportDecorator, UnlistableServer),