BOOST_FIXTURE_TEST_CASE(set_wrong_id_type, F) { cJSON *error = add_state_or_method_to_peer(&owner_peer, method_no_args_path, NULL, 0x00, CONFIG_ROUTED_MESSAGES_TIMEOUT); BOOST_CHECK(error == NULL); cJSON *call_json_rpc = create_call_json_rpc_wrong_id_type(method_no_args_path); error = set_or_call(&call_peer, method_no_args_path, NULL, NULL, call_json_rpc, METHOD); cJSON_Delete(call_json_rpc); if ((error != NULL) && (error != (cJSON *)ROUTED_MESSAGE)) { check_invalid_params(error); cJSON_Delete(error); } else { BOOST_FAIL("expected to get an error!"); } }
BOOST_FIXTURE_TEST_CASE(set_wrong_id_type, F) { const char path[] = "/foo/bar"; cJSON *request = create_add(path); cJSON *response = add_element_to_peer(&owner_peer, request); BOOST_REQUIRE_MESSAGE(response != NULL, "add_element_to_peer() had no response!"); BOOST_CHECK_MESSAGE(!response_is_error(response), "add_element_to_peer() failed!"); cJSON_Delete(response); cJSON *call_json_rpc = create_call_json_rpc_wrong_id_type(path); response = set_or_call(&call_peer, call_json_rpc, METHOD); cJSON_Delete(call_json_rpc); BOOST_REQUIRE_MESSAGE(response == NULL, "set_or_call() had a response despite illegal request id!"); cJSON_Delete(request); }