class documentation

class MockRemote: (source)

View In Hierarchy

Class representing mocked remote state. By default this class is set up for start/stop style patching as opposed to the more common context-manager or decorator approach; this is so it can be used in situations requiring setup/teardown semantics. Defaults to setting up a single anonymous `Session`, so it can be used as a "request & forget" pytest fixture. Users requiring detailed remote session expectations can call methods like `expect`, which wipe that anonymous Session & set up a new one instead. .. versionadded:: 2.1

Method __init__ Undocumented
Method expect Convenience method for creating & 'expect'ing a single `Session`.
Method expect_sessions Sets the mocked remote environment to expect the given ``sessions``.
Method sanity Run post-execution sanity checks (usually 'was X called' tests.)
Method start Start patching SSHClient with the stored sessions, returning channels.
Method stop Stop patching SSHClient.
Instance Variable patcher Undocumented
Instance Variable sessions Undocumented
def __init__(self): (source)

Undocumented

def expect(self, *args, **kwargs): (source)

Convenience method for creating & 'expect'ing a single `Session`. Returns the single `MockChannel` yielded by that Session. .. versionadded:: 2.1

def expect_sessions(self, *sessions): (source)

Sets the mocked remote environment to expect the given ``sessions``. Returns a list of `MockChannel` objects, one per input `Session`. .. versionadded:: 2.1

def sanity(self): (source)

Run post-execution sanity checks (usually 'was X called' tests.) .. versionadded:: 2.1

def start(self): (source)

Start patching SSHClient with the stored sessions, returning channels. .. versionadded:: 2.1

def stop(self): (source)

Stop patching SSHClient. .. versionadded:: 2.1

Undocumented

sessions = (source)

Undocumented