From b28c30a07e516b048bf76bbfac88fa5f2824a858 Mon Sep 17 00:00:00 2001 From: Mikkel Krautz Date: Sat, 27 Jan 2018 13:12:07 +0100 Subject: TestSelfSignedCertificate: add tests that exercise new email SAN behavior. This commit adds tests to ensure that it's now possible to create a client certificate without an email, and that creating a client certificate with an email still works. This is added because SelfSignedCertificate now conditionally adds an email subject alt name (SAN) to the generated certificate. If the passed-in email is empty, SelfSignedCertificat will not include the SAN. --- .../TestSelfSignedCertificate.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/tests') diff --git a/src/tests/TestSelfSignedCertificate/TestSelfSignedCertificate.cpp b/src/tests/TestSelfSignedCertificate/TestSelfSignedCertificate.cpp index 27d798f63..c06080367 100644 --- a/src/tests/TestSelfSignedCertificate/TestSelfSignedCertificate.cpp +++ b/src/tests/TestSelfSignedCertificate/TestSelfSignedCertificate.cpp @@ -41,6 +41,20 @@ void TestSelfSignedCertificate::exerciseClientCert() { QCOMPARE(ok, true); QCOMPARE(cert.isNull(), false); QCOMPARE(key.isNull(), false); + + // Test that users can create certificates without an email + // address set. + ok = SelfSignedCertificate::generateMumbleCertificate(QLatin1String("John Doe"), QString(), cert, key); + QCOMPARE(ok, true); + QCOMPARE(cert.isNull(), false); + QCOMPARE(key.isNull(), false); + + // Test that it's possible to create a client certificate with + // both a name and an email. + ok = SelfSignedCertificate::generateMumbleCertificate(QLatin1String("John Doe"), QLatin1String("john@doe.family"), cert, key); + QCOMPARE(ok, true); + QCOMPARE(cert.isNull(), false); + QCOMPARE(key.isNull(), false); } void TestSelfSignedCertificate::exerciseServerCert() { -- cgit v1.2.3