From 0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:14:42 +0200 Subject: Adding upstream version 1:2.11. Signed-off-by: Daniel Baumann --- test/t/test_dnssec_keygen.py | 80 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 test/t/test_dnssec_keygen.py (limited to 'test/t/test_dnssec_keygen.py') diff --git a/test/t/test_dnssec_keygen.py b/test/t/test_dnssec_keygen.py new file mode 100644 index 0000000..f8bd6fb --- /dev/null +++ b/test/t/test_dnssec_keygen.py @@ -0,0 +1,80 @@ +import pytest + + +@pytest.mark.bashcomp( + cmd="dnssec-keygen", pre_cmds=("PATH=$PATH:$PWD/dnssec-keygen",) +) +class TestDnssecKeygen: + @pytest.mark.complete("dnssec-keygen -") + def test_1(self, completion): + assert completion + assert not any(x.endswith(":") for x in completion) + + @pytest.mark.complete("dnssec-keygen -a ") + def test_2(self, completion): + assert completion + assert any(x in completion for x in ("HMAC-MD5", "RSASHA1", "ED25519")) + assert "|" not in completion + assert not any(x.startswith("-") for x in completion) + + @pytest.mark.complete("dnssec-keygen -n ") + def test_3(self, completion): + assert completion + assert "HOST" in completion + assert "|" not in completion + assert not any(x.startswith("-") for x in completion) + + @pytest.mark.complete("dnssec-keygen -f ") + def test_4(self, completion): + assert completion + assert "|" not in completion + assert not any(x.startswith("-") for x in completion) + + @pytest.mark.complete("dnssec-keygen ") + def test_5(self, completion): + assert not completion + + @pytest.mark.complete( + "dnssec-keygen -a ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_6(self, completion): + assert completion == sorted( + "RSA RSAMD5 DSA RSASHA1 NSEC3RSASHA1 NSEC3DSA " + "RSASHA256 RSASHA512 ECCGOST " + "ECDSAP256SHA256 ECDSAP384SHA384 " + "ED25519 ED448 DH " + "HMAC-MD5 HMAC-SHA1 HMAC-SHA224 HMAC-SHA256 " + "HMAC-SHA384 HMAC-SHA512".split() + ) + + @pytest.mark.complete( + "dnssec-keygen -n ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_7(self, completion): + assert completion == sorted("ZONE HOST ENTITY USER OTHER".split()) + + @pytest.mark.complete( + "dnssec-keygen -f ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_8(self, completion): + assert completion == sorted("KSK REVOKE".split()) + + @pytest.mark.complete( + "dnssec-keygen -T ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_9(self, completion): + assert completion == sorted("DNSKEY KEY".split()) + + @pytest.mark.complete( + "dnssec-keygen -t ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_10(self, completion): + assert completion == sorted( + "AUTHCONF NOAUTHCONF NOAUTH NOCONF".split() + ) + + @pytest.mark.complete( + "dnssec-keygen -m ", env=dict(PATH="$PWD/dnssec-keygen:$PATH") + ) + def test_11(self, completion): + assert completion == sorted("usage trace record size mctx".split()) -- cgit v1.2.3