53
53
raise NotImplementedError
56
class DecoratorServer(Server):
57
"""Server for the TransportDecorator for testing with.
59
To use this when subclassing TransportDecorator, override override the
60
get_decorator_class method.
63
def start_server(self, server=None):
64
"""See bzrlib.transport.Server.start_server.
66
:server: decorate the urls given by server. If not provided a
67
LocalServer is created.
69
if server is not None:
70
self._made_server = False
73
from bzrlib.transport.local import LocalURLServer
74
self._made_server = True
75
self._server = LocalURLServer()
76
self._server.start_server()
78
def stop_server(self):
80
self._server.stop_server()
82
def get_decorator_class(self):
83
"""Return the class of the decorators we should be constructing."""
84
raise NotImplementedError(self.get_decorator_class)
86
def get_url_prefix(self):
87
"""What URL prefix does this decorator produce?"""
88
return self.get_decorator_class()._get_url_prefix()
90
def get_bogus_url(self):
91
"""See bzrlib.transport.Server.get_bogus_url."""
92
return self.get_url_prefix() + self._server.get_bogus_url()
95
"""See bzrlib.transport.Server.get_url."""
96
return self.get_url_prefix() + self._server.get_url()