Refactor command handling
This now supports usage/help texts
This commit is contained in:
@ -83,8 +83,9 @@ class TestRegistrationErrors(BaseSshTests):
|
||||
output = await process.stdout.readline()
|
||||
assert "Enter public key" in output
|
||||
stdout, stderr = await process.communicate(public_key)
|
||||
assert isinstance(stderr, str)
|
||||
print(f"{stdout=!r}, {stderr=!r}")
|
||||
assert stderr == "Error: Invalid key type: Only RSA keys are supported."
|
||||
assert stderr.rstrip() == "Error: Invalid key type: Only RSA keys are supported."
|
||||
result = await process.wait()
|
||||
assert result.exit_status == 1
|
||||
|
||||
@ -102,8 +103,9 @@ class TestRegistrationErrors(BaseSshTests):
|
||||
output = await process.stdout.readline()
|
||||
assert "Enter public key" in output
|
||||
stdout, stderr = await process.communicate(public_key)
|
||||
assert isinstance(stderr, str)
|
||||
print(f"{stdout=!r}, {stderr=!r}")
|
||||
assert stderr == "Error: Invalid key type: Only RSA keys are supported."
|
||||
assert stderr.rstrip() == "Error: Invalid key type: Only RSA keys are supported."
|
||||
result = await process.wait()
|
||||
assert result.exit_status == 1
|
||||
|
||||
@ -122,7 +124,8 @@ class TestCommandErrors(BaseSshTests):
|
||||
|
||||
assert result.exit_status == 1
|
||||
stderr = result.stderr or ""
|
||||
assert stderr == "Error: Unsupported command."
|
||||
assert isinstance(stderr, str)
|
||||
assert stderr.rstrip() == "Error: Unsupported command."
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_no_command(
|
||||
@ -136,7 +139,8 @@ class TestCommandErrors(BaseSshTests):
|
||||
async with conn.create_process() as process:
|
||||
stdout, stderr = await process.communicate()
|
||||
print(f"{stdout=!r}, {stderr=!r}")
|
||||
assert stderr == "Error: No command was received from the client."
|
||||
assert isinstance(stderr, str)
|
||||
assert stderr.rstrip() == "Error: No command was received from the client."
|
||||
result = await process.wait()
|
||||
assert result.exit_status == 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user