1 #include "file_test_utilities.hpp"
2 #include "ssl_key_handler.hpp"
3 
4 #include <gmock/gmock.h>
5 #include <gtest/gtest.h>
6 
7 namespace ensuressl
8 {
9 
10 TEST(SSLKeyHandler, GenerateVerifyRoundTrip)
11 {
12     /* Verifies that we can generate a certificate, then read back in the
13      * certificate that was read */
14     TemporaryFileHandle myFile("");
15     std::string cert = generateSslCertificate("TestCommonName");
16 
17     EXPECT_FALSE(cert.empty());
18 
19     writeCertificateToFile(myFile.stringPath, cert);
20 
21     std::string cert2 = verifyOpensslKeyCert(myFile.stringPath);
22     EXPECT_FALSE(cert2.empty());
23     EXPECT_EQ(cert, cert2);
24 }
25 
26 } // namespace ensuressl
27