1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00
falk-werner_webfuse-provider/test/webfuse_provider/jsonrpc/test_request.cc

27 lines
742 B
C++
Raw Normal View History

2020-06-16 21:39:45 +00:00
#include "webfuse_provider/impl/jsonrpc/request.h"
#include "webfuse_provider/test_util/json_doc.hpp"
2020-07-10 21:27:33 +00:00
#include <gtest/gtest.h>
using webfuse_test::JsonDoc;
TEST(wfp_jsonrpc_request, is_request_object_params)
2020-03-22 12:36:03 +00:00
{
JsonDoc doc("{\"method\": \"some_method\", \"params\": { }, \"id\": 42}");
2020-03-22 12:36:03 +00:00
ASSERT_TRUE(wfp_jsonrpc_is_request(doc.root()));
2020-03-22 12:36:03 +00:00
}
TEST(wfp_jsonrpc_request, is_request_fail_missing_params)
2020-03-22 12:36:03 +00:00
{
JsonDoc doc("{\"method\": \"some_method\", \"id\": 42}");
2020-03-22 12:36:03 +00:00
ASSERT_FALSE(wfp_jsonrpc_is_request(doc.root()));
2020-03-22 12:36:03 +00:00
}
TEST(wfp_jsonrpc_request, is_request_fail_params_wrong_type)
2020-03-22 12:36:03 +00:00
{
JsonDoc doc("{\"method\": \"some_method\", \"params\": \"invalid_params\", \"id\": 42}");
2020-03-22 12:36:03 +00:00
ASSERT_FALSE(wfp_jsonrpc_is_request(doc.root()));
2020-03-22 12:36:03 +00:00
}