class MockRemote: (source)
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 |
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 |
Convenience method for creating & 'expect'ing a single `Session`. Returns the single `MockChannel` yielded by that Session. .. versionadded:: 2.1
Sets the mocked remote environment to expect the given ``sessions``. Returns a list of `MockChannel` objects, one per input `Session`. .. versionadded:: 2.1