mirror of
https://github.com/falk-werner/webfuse
synced 2024-10-27 20:34:10 +00:00
increased test coverage
This commit is contained in:
parent
843368f483
commit
643d1d5237
@ -101,3 +101,38 @@ TEST(wf_jsonrpc_request, respond_error)
|
||||
|
||||
json_decref(response);
|
||||
}
|
||||
|
||||
TEST(wf_jsonrpc_request, is_request_object_params)
|
||||
{
|
||||
json_t * request = json_object();
|
||||
json_object_set_new(request, "method", json_string("some_method"));
|
||||
json_object_set_new(request, "params", json_object());
|
||||
json_object_set_new(request, "id", json_integer(42));
|
||||
|
||||
ASSERT_TRUE(wf_jsonrpc_is_request(request));
|
||||
|
||||
json_decref(request);
|
||||
}
|
||||
|
||||
TEST(wf_jsonrpc_request, is_request_fail_missing_params)
|
||||
{
|
||||
json_t * request = json_object();
|
||||
json_object_set_new(request, "method", json_string("some_method"));
|
||||
json_object_set_new(request, "id", json_integer(42));
|
||||
|
||||
ASSERT_FALSE(wf_jsonrpc_is_request(request));
|
||||
|
||||
json_decref(request);
|
||||
}
|
||||
|
||||
TEST(wf_jsonrpc_request, is_request_fail_params_wrong_type)
|
||||
{
|
||||
json_t * request = json_object();
|
||||
json_object_set_new(request, "method", json_string("some_method"));
|
||||
json_object_set_new(request, "params", json_string("invalid_params"));
|
||||
json_object_set_new(request, "id", json_integer(42));
|
||||
|
||||
ASSERT_FALSE(wf_jsonrpc_is_request(request));
|
||||
|
||||
json_decref(request);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user