Converting a remote command to something that other libs uses requires
converting the enum to a string. Python behavior in the area varies
across versions so add a unit test that verifies the conversion
behaves as intended.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
class TestWithoutSSH:
def test_can_run(self, cephadm_module: CephadmOrchestrator):
assert cephadm_module.can_run() == (False, "loading asyncssh library:No module named 'asyncssh'")
+
+
+def test_remote_command():
+ from cephadm.ssh import RemoteCommand, Executables
+
+ assert list(RemoteCommand(Executables.TRUE)) == ['true']
+ assert list(RemoteCommand(Executables.RM, ['-rf', '/tmp/blat'])) == [
+ 'rm',
+ '-rf',
+ '/tmp/blat',
+ ]