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

69 lines
2.1 KiB
C++
Raw Normal View History

2020-06-11 16:07:42 +00:00
#include <gtest/gtest.h>
#include "webfuse/adapter/client_tlsconfig.h"
#include "webfuse/adapter/impl/client_tlsconfig.h"
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);
}