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.
This commit is contained in:
Mikkel Krautz 2018-01-27 13:12:07 +01:00
parent 519d04bb3a
commit b28c30a07e

View File

@ -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() {