92
92
The client simply delegates record_iternext calls to it's server stub.
94
There's really no decent way to test ZEO without running to muc crazy
95
stuff. I'd rather to a lame test than a really lame test, so here goes.
94
There's really no decent way to test ZEO without running too much crazy
95
stuff. I'd rather do a lame test than a really lame test, so here goes.
97
97
First, fake out the connection manager so we can make a connection:
108
108
>>> client = ClientStorage('', wait=False)
109
109
>>> ClientStorage.ConnectionManagerClass = oldConnectionManagerClass
111
Now we'll have our way with it's provate _server attr:
111
Now we'll have our way with it's private _server attr:
113
113
>>> client._server = FakeStorage()
130
130
The server stub simply delegates record_iternext calls to it's rpc.
132
There's really no decent way to test ZEO without running to muc crazy
133
stuff. I'd rather to a lame test than a really lame test, so here goes.
132
There's really no decent way to test ZEO without running to much crazy
133
stuff. I'd rather do a lame test than a really lame test, so here goes.
135
135
>>> class FauxRPC:
136
136
... storage = FakeStorage()
156
def history_to_version_compatible_storage():
158
Some storages work under ZODB <= 3.8 and ZODB >= 3.9.
159
This means they have a history method that accepts a version parameter:
161
>>> class VersionCompatibleStorage(FakeStorageBase):
162
... def history(self,oid,version='',size=1):
163
... return oid,version,size
165
A ZEOStorage such as the following should support this type of storage:
167
>>> class OurFakeServer(FakeServer):
168
... storages = {'1':VersionCompatibleStorage()}
169
>>> import ZEO.StorageServer
170
>>> zeo = ZEO.StorageServer.ZEOStorage(OurFakeServer(), False)
171
>>> zeo.register('1', False)
173
The ZEOStorage should sort out the following call such that the storage gets
174
the correct parameters and so should return the parameters it was called with:
176
>>> zeo.history('oid',99)
179
The same problem occurs when a Z308 client connects to a Z309 server,
180
but different code is executed:
182
>>> from ZEO.StorageServer import ZEOStorage308Adapter
183
>>> zeo = ZEOStorage308Adapter(VersionCompatibleStorage())
185
The history method should still return the parameters it was called with:
187
>>> zeo.history('oid','',99)
156
191
def test_suite():
157
192
return doctest.DocTestSuite()