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