module documentation

Remote API test utilities.

Class FakeCurl Fake cURL object.
Class InputTestClient Test version of RAPI client.
Exception VerificationError Dedicated error class for test utilities.
Function VerifyOpInput Verifies opcode parameters according to their definition.
Function VerifyOpResult Verifies opcode results used in tests (e.g. in a mock).
Class _LuxiCallRecorder Records all called LUXI client methods.
Class _RapiMock Mocking out the RAPI server parts.
Class _TestLuxiTransport Mocked LUXI transport.
Function _FormatHeaders Formats HTTP headers.
Function _GetOpById Tries to get an opcode class based on its OP_ID.
Function _GetPathFromUri Gets the path and query from a URI.
Function _HideInternalErrors Hides Ganeti-internal exceptions, see VerificationError.
Function _TestWrapper Wrapper for ignoring errors.RapiTestResult.
Constant _URI_RE Undocumented
@_HideInternalErrors
def VerifyOpInput(op_id, data):

Verifies opcode parameters according to their definition.

Parameters
op_id:stringOpcode ID (OP_ID attribute), e.g. OP_CLUSTER_VERIFY
data:dictOpcode parameter values
Raises
VerificationErrorParameter verification failed
@_HideInternalErrors
def VerifyOpResult(op_id, result):

Verifies opcode results used in tests (e.g. in a mock).

Parameters
op_id:stringOpcode ID (OP_ID attribute), e.g. OP_CLUSTER_VERIFY
resultMocked opcode result
Raises
VerificationErrorReturn value verification failed
def _FormatHeaders(headers):

Formats HTTP headers.

Parameters
headers:sequence of stringsUndocumented
Returns
stringUndocumented
def _GetOpById(op_id):

Tries to get an opcode class based on its OP_ID.

def _GetPathFromUri(uri):

Gets the path and query from a URI.

def _HideInternalErrors(fn):

Hides Ganeti-internal exceptions, see VerificationError.

def _TestWrapper(fn, *args, **kwargs):

Wrapper for ignoring errors.RapiTestResult.

_URI_RE =

Undocumented

Value
re.compile(r'https://(?P<host>.*):(?P<port>\d+)(?P<path>/.*)')