comparison test/test_svrauth.py @ 1887:30fd047f6ebf

Fix pytest incorrect skip "reason" string No change to functionality
author Matt Johnston <matt@ucc.asn.au>
date Wed, 16 Mar 2022 17:32:43 +0800
parents 5d8dbb6fdab7
children
comparison
equal deleted inserted replaced
1886:e128d6bc3d8f 1887:30fd047f6ebf
6 from pathlib import Path 6 from pathlib import Path
7 7
8 # Tests for server side authentication 8 # Tests for server side authentication
9 9
10 # Requires keyfile and authorized_keys set up in github action build.yml 10 # Requires keyfile and authorized_keys set up in github action build.yml
11 @pytest.mark.skipif('DBTEST_IN_ACTION' not in os.environ, reason="DBTEST_PUBKEYINFO not set") 11 @pytest.mark.skipif('DBTEST_IN_ACTION' not in os.environ, reason="DBTEST_IN_ACTION not set")
12 def test_pubkeyinfo(request, dropbear): 12 def test_pubkeyinfo(request, dropbear):
13 kf = str(Path.home() / ".ssh/id_dropbear_key2") 13 kf = str(Path.home() / ".ssh/id_dropbear_key2")
14 r = dbclient(request, "-i", kf, "echo -n $SSH_PUBKEYINFO", capture_output=True) 14 r = dbclient(request, "-i", kf, "echo -n $SSH_PUBKEYINFO", capture_output=True)
15 # stop at first space 15 # stop at first space
16 assert r.stdout.decode() == "key2" 16 assert r.stdout.decode() == "key2"
17 17
18 @pytest.mark.skipif('DBTEST_IN_ACTION' not in os.environ, reason="DBTEST_PUBKEYINFO not set") 18 @pytest.mark.skipif('DBTEST_IN_ACTION' not in os.environ, reason="DBTEST_IN_ACTION not set")
19 def test_pubkeyinfo_special(request, dropbear): 19 def test_pubkeyinfo_special(request, dropbear):
20 kf = str(Path.home() / ".ssh/id_dropbear_key3") 20 kf = str(Path.home() / ".ssh/id_dropbear_key3")
21 r = dbclient(request, "-i", kf, "echo -n $SSH_PUBKEYINFO", capture_output=True) 21 r = dbclient(request, "-i", kf, "echo -n $SSH_PUBKEYINFO", capture_output=True)
22 # comment contains special characters so the SSH_PUBKEYINFO should not be set 22 # comment contains special characters so the SSH_PUBKEYINFO should not be set
23 assert r.stdout.decode() == "" 23 assert r.stdout.decode() == ""
24 24
25 @pytest.mark.skipif('DBTEST_IN_ACTION' not in os.environ, reason="DBTEST_PUBKEYINFO not set") 25 @pytest.mark.skipif('DBTEST_IN_ACTION' not in os.environ, reason="DBTEST_IN_ACTION not set")
26 def test_pubkeyinfo_okchar(request, dropbear): 26 def test_pubkeyinfo_okchar(request, dropbear):
27 kf = str(Path.home() / ".ssh/id_dropbear_key4") 27 kf = str(Path.home() / ".ssh/id_dropbear_key4")
28 r = dbclient(request, "-i", kf, "echo -n $SSH_PUBKEYINFO", capture_output=True) 28 r = dbclient(request, "-i", kf, "echo -n $SSH_PUBKEYINFO", capture_output=True)
29 # comment contains special characters so the SSH_PUBKEYINFO should not be set 29 # comment contains special characters so the SSH_PUBKEYINFO should not be set
30 assert r.stdout.decode() == "key4,char" 30 assert r.stdout.decode() == "key4,char"