mirror of
https://github.com/falk-werner/webfuse-provider
synced 2024-10-27 20:44:10 +00:00
added tests for connect failure
This commit is contained in:
parent
b45b7873ab
commit
e465265f3a
@ -44,6 +44,51 @@ TEST(Client, Connect)
|
|||||||
wfp_client_config_dispose(config);
|
wfp_client_config_dispose(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Client, ConnectFailWithInvalidUrl)
|
||||||
|
{
|
||||||
|
MockProviderClient provider;
|
||||||
|
|
||||||
|
EXPECT_CALL(provider, OnConnected()).Times(0);
|
||||||
|
|
||||||
|
std::promise<void> disconnected;
|
||||||
|
EXPECT_CALL(provider, OnDisconnected()).Times(1)
|
||||||
|
.WillOnce(Invoke([&]() { disconnected.set_value(); }));
|
||||||
|
|
||||||
|
wfp_client_config * config = wfp_client_config_create();
|
||||||
|
provider.AttachTo(config);
|
||||||
|
|
||||||
|
{
|
||||||
|
Client client(config, "invalid_url");
|
||||||
|
|
||||||
|
ASSERT_EQ(std::future_status::ready, disconnected.get_future().wait_for(TIMEOUT));
|
||||||
|
}
|
||||||
|
|
||||||
|
wfp_client_config_dispose(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Client, ConnectFailNotReachable)
|
||||||
|
{
|
||||||
|
MockProviderClient provider;
|
||||||
|
|
||||||
|
EXPECT_CALL(provider, OnConnected()).Times(0);
|
||||||
|
|
||||||
|
std::promise<void> disconnected;
|
||||||
|
EXPECT_CALL(provider, OnDisconnected()).Times(1)
|
||||||
|
.WillOnce(Invoke([&]() { disconnected.set_value(); }));
|
||||||
|
|
||||||
|
wfp_client_config * config = wfp_client_config_create();
|
||||||
|
provider.AttachTo(config);
|
||||||
|
|
||||||
|
{
|
||||||
|
Client client(config, "ws://localhost:4/");
|
||||||
|
|
||||||
|
ASSERT_EQ(std::future_status::ready, disconnected.get_future().wait_for(TIMEOUT));
|
||||||
|
}
|
||||||
|
|
||||||
|
wfp_client_config_dispose(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(Client, Lookup)
|
TEST(Client, Lookup)
|
||||||
{
|
{
|
||||||
MockProviderClient provider;
|
MockProviderClient provider;
|
||||||
|
Loading…
Reference in New Issue
Block a user