linkahead.connection.mockup module

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

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

Bases: CaosDBHTTPResponse

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

close()

close.

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.

getheaders()

Return all headers.

read(size=-1)

Return the body of the response.

property status

Return the status of the response.

class linkahead.connection.mockup.MockUpServerConnection

Bases: CaosDBServerConnection

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

configure(**kwargs)

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.