From 110a7c22926c067e65cfaa05c19aac12b637eb79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20S=C3=BAkup?= Date: Wed, 6 Mar 2019 15:25:28 +0100 Subject: [PATCH] Test ed25519 and curve448 only if is available --- tests/test_agent.py | 3 ++- tests/test_kex.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_agent.py b/tests/test_agent.py index 6dd30b1..08237c1 100644 --- a/tests/test_agent.py +++ b/tests/test_agent.py @@ -29,6 +29,7 @@ import asyncssh +from asyncssh.crypto.ed import ed25519_available from asyncssh.agent import SSH_AGENT_SUCCESS, SSH_AGENT_FAILURE from asyncssh.packet import Byte, String @@ -175,7 +176,7 @@ def test_sign(self, agent): algs = ['ssh-dss', 'ssh-rsa', 'ecdsa-sha2-nistp256'] - if libnacl_available: # pragma: no branch + if ed25519_available: # pragma: no branch algs.append('ssh-ed25519') for alg_name in algs: diff --git a/tests/test_kex.py b/tests/test_kex.py index 1512e40..86a75c6 100644 --- a/tests/test_kex.py +++ b/tests/test_kex.py @@ -27,6 +27,7 @@ import asyncssh + from asyncssh.kex_dh import MSG_KEXDH_INIT, MSG_KEXDH_REPLY from asyncssh.kex_dh import MSG_KEX_DH_GEX_REQUEST, MSG_KEX_DH_GEX_GROUP from asyncssh.kex_dh import MSG_KEX_DH_GEX_INIT, MSG_KEX_DH_GEX_REPLY, _KexDHGex @@ -39,6 +40,7 @@ from asyncssh.kex import register_kex_alg, get_kex_algs, get_kex from asyncssh.packet import SSHPacket, Boolean, Byte, MPInt, String from asyncssh.public_key import SSHLocalKeyPair, decode_ssh_public_key +from asyncssh.crypto.ed import curve448_available from .util import asynctest, gss_available, patch_gss from .util import AsyncTestCase, ConnectionStub @@ -523,6 +525,9 @@ def test_curve448dh_errors(self): except ImportError: # pragma: no cover return + if not curve448_available: # pragma: no cover + return + client_conn, server_conn = \ _KexClientStub.make_pair(b'curve448-sha512')