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

refactor: renamed getter functions of json node

This commit is contained in:
Falk Werner
2020-07-12 15:34:50 +02:00
parent bf8ba05863
commit ea15d8c5cf
17 changed files with 60 additions and 60 deletions

View File

@@ -155,13 +155,13 @@ TEST(Client, Lookup)
wfp_json const * result = wfp_impl_json_object_get(response, "result");
wfp_json const * inode = wfp_impl_json_object_get(result, "inode");
ASSERT_EQ(42, wfp_impl_json_get_int(inode));
ASSERT_EQ(42, wfp_impl_json_int_get(inode));
wfp_json const * mode = wfp_impl_json_object_get(result, "mode");
ASSERT_EQ(0644, wfp_impl_json_get_int(mode));
ASSERT_EQ(0644, wfp_impl_json_int_get(mode));
wfp_json const * type = wfp_impl_json_object_get(result, "type");
ASSERT_STREQ("file", wfp_impl_json_get_string(type));
ASSERT_STREQ("file", wfp_impl_json_string_get(type));
client.Disconnect();
ASSERT_EQ(std::future_status::ready, disconnected.get_future().wait_for(TIMEOUT));
@@ -203,7 +203,7 @@ TEST(Client, LookupFail)
wfp_json const * error = wfp_impl_json_object_get(response, "error");
wfp_json const * code = wfp_impl_json_object_get(error, "code");
ASSERT_NE(0, wfp_impl_json_get_int(code));
ASSERT_NE(0, wfp_impl_json_int_get(code));
client.Disconnect();
ASSERT_EQ(std::future_status::ready, disconnected.get_future().wait_for(TIMEOUT));
@@ -245,7 +245,7 @@ TEST(Client, Open)
wfp_json const * result = wfp_impl_json_object_get(response, "result");
wfp_json const * handle = wfp_impl_json_object_get(result, "handle");
ASSERT_EQ(4711, wfp_impl_json_get_int(handle));
ASSERT_EQ(4711, wfp_impl_json_int_get(handle));
client.Disconnect();
ASSERT_EQ(std::future_status::ready, disconnected.get_future().wait_for(TIMEOUT));
@@ -288,13 +288,13 @@ TEST(Client, Read)
wfp_json const * result = wfp_impl_json_object_get(response, "result");
wfp_json const * format = wfp_impl_json_object_get(result, "format");
ASSERT_STREQ("base64", wfp_impl_json_get_string(format));
ASSERT_STREQ("base64", wfp_impl_json_string_get(format));
wfp_json const * count = wfp_impl_json_object_get(result, "count");
ASSERT_EQ(1, wfp_impl_json_get_int(count));
ASSERT_EQ(1, wfp_impl_json_int_get(count));
wfp_json const * data = wfp_impl_json_object_get(result, "data");
ASSERT_STREQ("Kg==", wfp_impl_json_get_string(data));
ASSERT_STREQ("Kg==", wfp_impl_json_string_get(data));
client.Disconnect();
ASSERT_EQ(std::future_status::ready, disconnected.get_future().wait_for(TIMEOUT));

View File

@@ -109,7 +109,7 @@ public:
wfp_json const * method = wfp_impl_json_object_get(request, "method");
ASSERT_TRUE(wfp_impl_json_is_string(method));
ASSERT_STREQ("authenticate", wfp_impl_json_get_string(method));
ASSERT_STREQ("authenticate", wfp_impl_json_string_get(method));
wfp_json const * id = wfp_impl_json_object_get(request, "id");
ASSERT_TRUE(wfp_impl_json_is_int(id));
@@ -120,21 +120,21 @@ public:
wfp_json const * type = wfp_impl_json_array_get(params, 0);
ASSERT_TRUE(wfp_impl_json_is_string(type));
ASSERT_STREQ("username", wfp_impl_json_get_string(type));
ASSERT_STREQ("username", wfp_impl_json_string_get(type));
wfp_json const * credentials = wfp_impl_json_array_get(params, 1);
ASSERT_TRUE(wfp_impl_json_is_object(credentials));
wfp_json const * username = wfp_impl_json_object_get(credentials, "username");
ASSERT_TRUE(wfp_impl_json_is_string(username));
ASSERT_STREQ(expected_username.c_str(), wfp_impl_json_get_string(username));
ASSERT_STREQ(expected_username.c_str(), wfp_impl_json_string_get(username));
wfp_json const * password = wfp_impl_json_object_get(credentials, "password");
ASSERT_TRUE(wfp_impl_json_is_string(password));
ASSERT_STREQ(expected_password.c_str(), wfp_impl_json_get_string(password));
ASSERT_STREQ(expected_password.c_str(), wfp_impl_json_string_get(password));
std::ostringstream response;
response << "{\"result\": {}, \"id\": " << wfp_impl_json_get_int(id) << "}";
response << "{\"result\": {}, \"id\": " << wfp_impl_json_int_get(id) << "}";
SendToClient(response.str());
}
@@ -146,7 +146,7 @@ public:
wfp_json const * method = wfp_impl_json_object_get(request, "method");
ASSERT_TRUE(wfp_impl_json_is_string(method));
ASSERT_STREQ("add_filesystem", wfp_impl_json_get_string(method));
ASSERT_STREQ("add_filesystem", wfp_impl_json_string_get(method));
wfp_json const * params = wfp_impl_json_object_get(request, "params");
ASSERT_TRUE(wfp_impl_json_is_array(params));
@@ -159,7 +159,7 @@ public:
ASSERT_TRUE(wfp_impl_json_is_int(id));
std::ostringstream response;
response << "{\"result\": {\"id\": \"" << wfp_impl_json_get_string(filesystem) << "\"}, \"id\": " << wfp_impl_json_get_int(id) << "}";
response << "{\"result\": {\"id\": \"" << wfp_impl_json_string_get(filesystem) << "\"}, \"id\": " << wfp_impl_json_int_get(id) << "}";
SendToClient(response.str());
}