Sample pseudocode:
def test(myhost: str, myuser: str):
options = SSHClientConnectionOptions()
options.username = myuser
async with asyncssh.connect(
host=host,
options=options,
) as conn:
result = await conn.run("whoami", check=True)
assert isinstance(result.stdout, str)
assert result.stdout.strip() == myuser
The username passed in SSHClientConnectionOptions is ignored, local username is used instead. Works as expected if username is passed into asyncssh.connect kwargs instead.
Can be trivially reproduced without a target, this sample fails:
async def test_options_construct_ignores_username():
options = SSHClientConnectionOptions()
options.username = "user"
new_options = await SSHClientConnectionOptions.construct(options)
assert new_options.username == "user"
Sample pseudocode:
The username passed in SSHClientConnectionOptions is ignored, local username is used instead. Works as expected if username is passed into asyncssh.connect kwargs instead.
Can be trivially reproduced without a target, this sample fails: