1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00
falk-werner_webfuse/test/webfuse/test_client_tlsconfig.cc

69 lines
2.0 KiB
C++
Raw Normal View History

2020-06-11 16:07:42 +00:00
#include <gtest/gtest.h>
2020-06-28 13:51:34 +00:00
#include "webfuse/client_tlsconfig.h"
#include "webfuse/impl/client_tlsconfig.h"
2020-06-11 16:07:42 +00:00
TEST(ClientTlsConfig, InitAndCleanup)
{
wf_client_tlsconfig config;
wf_impl_client_tlsconfig_init(&config);
wf_impl_client_tlsconfig_cleanup(&config);
}
TEST(ClientTlsConfig, SetKeyPath)
{
wf_client_tlsconfig config;
wf_impl_client_tlsconfig_init(&config);
wf_client_tlsconfig_set_keypath(&config, "/path/to/key.pem");
ASSERT_STREQ("/path/to/key.pem", config.key_path);
wf_impl_client_tlsconfig_cleanup(&config);
}
TEST(ClientTlsConfig, SetCertPath)
{
wf_client_tlsconfig config;
wf_impl_client_tlsconfig_init(&config);
wf_client_tlsconfig_set_certpath(&config, "/path/to/cert.pem");
ASSERT_STREQ("/path/to/cert.pem", config.cert_path);
wf_impl_client_tlsconfig_cleanup(&config);
}
TEST(ClientTlsConfig, SetCafilePath)
{
wf_client_tlsconfig config;
wf_impl_client_tlsconfig_init(&config);
wf_client_tlsconfig_set_cafilepath(&config, "/path/to/cafile.pem");
ASSERT_STREQ("/path/to/cafile.pem", config.cafile_path);
wf_impl_client_tlsconfig_cleanup(&config);
}
TEST(ClientTslConfig, IsSet)
{
wf_client_tlsconfig config;
wf_impl_client_tlsconfig_init(&config);
ASSERT_FALSE(wf_impl_client_tlsconfig_isset(&config));
wf_impl_client_tlsconfig_cleanup(&config);
wf_impl_client_tlsconfig_init(&config);
wf_client_tlsconfig_set_keypath(&config, "/path/to/key.pem");
ASSERT_FALSE(wf_impl_client_tlsconfig_isset(&config));
wf_impl_client_tlsconfig_cleanup(&config);
wf_impl_client_tlsconfig_init(&config);
wf_client_tlsconfig_set_certpath(&config, "/path/to/cert.pem");
ASSERT_FALSE(wf_impl_client_tlsconfig_isset(&config));
wf_impl_client_tlsconfig_cleanup(&config);
wf_impl_client_tlsconfig_init(&config);
wf_client_tlsconfig_set_keypath(&config, "/path/to/key.pem");
wf_client_tlsconfig_set_certpath(&config, "/path/to/cert.pem");
ASSERT_TRUE(wf_impl_client_tlsconfig_isset(&config));
wf_impl_client_tlsconfig_cleanup(&config);
}