1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2026-03-02 04:09:18 +00:00

fix: don't send messages if not connected

This commit is contained in:
Falk Werner
2020-06-13 17:08:05 +02:00
parent 55de95caf7
commit 4713ec3e93
4 changed files with 52 additions and 5 deletions

View File

@@ -208,6 +208,33 @@ TEST(AdapterClient, Authenticate)
wf_client_dispose(client);
}
TEST(AdapterClient, AuthenticateFailedWithoutConnect)
{
TimeoutWatcher watcher(TIMEOUT);
MockAdapterClientCallback callback;
EXPECT_CALL(callback, Invoke(_, _, _)).Times(AnyNumber());
EXPECT_CALL(callback, Invoke(_, WF_CLIENT_AUTHENTICATE_GET_CREDENTIALS, _)).Times(1)
.WillOnce(Invoke(GetCredentials));
bool called = false;
EXPECT_CALL(callback, Invoke(_, WF_CLIENT_AUTHENTICATION_FAILED, nullptr)).Times(1)
.WillOnce(Invoke([&called] (wf_client *, int, void *) mutable {
called = true;
}));
wf_client * client = wf_client_create(
callback.GetCallbackFn(), callback.GetUserData());
wf_client_authenticate(client);
while (!called) {
watcher.check();
wf_client_service(client);
}
wf_client_dispose(client);
}
TEST(AdapterClient, AuthenticationFailed)
{
TimeoutWatcher watcher(TIMEOUT);

View File

@@ -0,0 +1,16 @@
#include <gtest/gtest.h>
#include <jansson.h>
namespace webfuse_test
{
class JanssonTestEnvironment: public ::testing::Environment
{
public:
void SetUp()
{
json_object_seed(0);
}
};
#
}