diff options
author | Mikkel Krautz <mikkel@krautz.dk> | 2018-01-27 15:12:07 +0300 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2018-01-27 15:12:07 +0300 |
commit | b28c30a07e516b048bf76bbfac88fa5f2824a858 (patch) | |
tree | 8028d59dd58829dafcb05c415078e8c3699baca9 /src/tests | |
parent | 519d04bb3a579702add8f8878e9db6c5a8960599 (diff) |
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.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/TestSelfSignedCertificate/TestSelfSignedCertificate.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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() { |