added test for add_fileystem

pull/79/head
Falk Werner 4 years ago
parent b0e211789b
commit 4f8d438e45

@ -102,6 +102,72 @@ TEST(server, add_filesystem)
ASSERT_TRUE(disconnected);
}
TEST(server, add_filesystem_fail_missing_param)
{
Server server;
MockInvokationHander handler;
WsClient client(handler, WF_PROTOCOL_NAME_PROVIDER_CLIENT);
auto connected = client.Connect(server.GetPort(), WF_PROTOCOL_NAME_ADAPTER_SERVER);
ASSERT_TRUE(connected);
std::string response_text = client.Invoke("{\"method\": \"add_filesystem\", \"params\": [], \"id\": 42}");
json_t * response = json_loads(response_text.c_str(), 0, nullptr);
ASSERT_TRUE(json_is_object(response));
json_t * error = json_object_get(response, "error");
ASSERT_TRUE(json_is_object(error));
json_t * id = json_object_get(response, "id");
ASSERT_EQ(42, json_integer_value(id));
json_decref(response);
auto disconnected = client.Disconnect();
ASSERT_TRUE(disconnected);
}
TEST(server, add_filesystem_fail_invalid_name_type)
{
Server server;
MockInvokationHander handler;
WsClient client(handler, WF_PROTOCOL_NAME_PROVIDER_CLIENT);
auto connected = client.Connect(server.GetPort(), WF_PROTOCOL_NAME_ADAPTER_SERVER);
ASSERT_TRUE(connected);
std::string response_text = client.Invoke("{\"method\": \"add_filesystem\", \"params\": [42], \"id\": 42}");
json_t * response = json_loads(response_text.c_str(), 0, nullptr);
ASSERT_TRUE(json_is_object(response));
json_t * error = json_object_get(response, "error");
ASSERT_TRUE(json_is_object(error));
json_t * id = json_object_get(response, "id");
ASSERT_EQ(42, json_integer_value(id));
json_decref(response);
auto disconnected = client.Disconnect();
ASSERT_TRUE(disconnected);
}
TEST(server, add_filesystem_fail_invalid_name)
{
Server server;
MockInvokationHander handler;
WsClient client(handler, WF_PROTOCOL_NAME_PROVIDER_CLIENT);
auto connected = client.Connect(server.GetPort(), WF_PROTOCOL_NAME_ADAPTER_SERVER);
ASSERT_TRUE(connected);
std::string response_text = client.Invoke("{\"method\": \"add_filesystem\", \"params\": [\"invalid/name\"], \"id\": 42}");
json_t * response = json_loads(response_text.c_str(), 0, nullptr);
ASSERT_TRUE(json_is_object(response));
json_t * error = json_object_get(response, "error");
ASSERT_TRUE(json_is_object(error));
json_t * id = json_object_get(response, "id");
ASSERT_EQ(42, json_integer_value(id));
json_decref(response);
auto disconnected = client.Disconnect();
ASSERT_TRUE(disconnected);
}
TEST(server, authenticate)
{

Loading…
Cancel
Save