1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00

add test for connect failure

This commit is contained in:
Falk Werner 2020-06-14 20:20:14 +02:00
parent 8de8ec0003
commit 01a9488f6e

View File

@ -124,6 +124,27 @@ TEST(AdapterClient, ConnectWithTls)
ASSERT_TRUE(watcher.waitUntil([&]() mutable { return disconnected; })); ASSERT_TRUE(watcher.waitUntil([&]() mutable { return disconnected; }));
} }
TEST(AdapterClient, FailedToConnectInvalidPort)
{
TimeoutWatcher watcher(TIMEOUT);
MockAdapterClientCallback callback;
EXPECT_CALL(callback, Invoke(_, WF_CLIENT_INIT, nullptr)).Times(1);
EXPECT_CALL(callback, Invoke(_, WF_CLIENT_CREATED, nullptr)).Times(1);
EXPECT_CALL(callback, Invoke(_, WF_CLIENT_GET_TLS_CONFIG, _)).Times(1);
EXPECT_CALL(callback, Invoke(_, WF_CLIENT_CLEANUP, nullptr)).Times(1);
bool disconnected = false;
EXPECT_CALL(callback, Invoke(_, WF_CLIENT_DISCONNECTED, nullptr)).Times(1)
.WillOnce(Invoke([&] (wf_client *, int, void *) mutable { disconnected = true; }));
AdapterClient client(callback.GetCallbackFn(), callback.GetUserData(), "ws://localhost:4/");
client.Connect();
ASSERT_TRUE(watcher.waitUntil([&]() mutable { return disconnected; }));
}
TEST(AdapterClient, Authenticate) TEST(AdapterClient, Authenticate)
{ {