caosdb.connection.mockup module

Classes and functions to immitate a caosdb server without actually setting up a tcp connection.

class caosdb.connection.mockup.MockUpResponse(status, headers, body)

Bases: caosdb.connection.interface.CaosDBHTTPResponse

A class for the responses of a request to the MockUpServerConnection.



Close this response. Depending on the implementation this might also close underlying streams, sockets etc.

getheader(name, default=None)

Get the contents of the header name, or default if there is no matching header.


Return all headers.

read(size=- 1)

Return the body of the response.

property status

Return the status of the response.

class caosdb.connection.mockup.MockUpServerConnection

Bases: caosdb.connection.interface.CaosDBServerConnection

The mock-up connection which does not actually connect to anything but just returns predefined responses which mimic the caosdb server.


This configure method does nothing.

request(method, path, headers=None, body=None, **kwargs)

Search a resource in the resources list which is answering to the request and return the response or raise a RuntimeError.