diff --git a/tests/np2_test.h b/tests/np2_test.h index bea7536c..798d1716 100644 --- a/tests/np2_test.h +++ b/tests/np2_test.h @@ -83,6 +83,9 @@ struct np2_test { } \ assert_null(state->op); +#define ASSERT_OK_REPLY(state) \ + ASSERT_OK_REPLY_PARAM(state->nc_sess, 3000, state) + #define ASSERT_DATA_REPLY_PARAM(nc_sess, timeout_ms, state) \ do { \ state->msgtype = nc_recv_reply(nc_sess, state->rpc, state->msgid, timeout_ms, &state->envp, &state->op); \ @@ -102,8 +105,8 @@ struct np2_test { } \ assert_int_equal(LY_SUCCESS, lyd_print_mem(&state->str, state->op, LYD_XML, 0)); -#define ASSERT_OK_REPLY(state) \ - ASSERT_OK_REPLY_PARAM(state->nc_sess, 3000, state) +#define ASSERT_DATA_REPLY(state) \ + ASSERT_DATA_REPLY_PARAM(state->nc_sess, 3000, state) #define ASSERT_OK_REPLY_SESS2(state) \ state->msgtype = nc_recv_reply(state->nc_sess2, state->rpc, state->msgid, 3000, &state->envp, &state->op); \ diff --git a/tests/test_rpc.c b/tests/test_rpc.c index 7d3d920f..c8056799 100644 --- a/tests/test_rpc.c +++ b/tests/test_rpc.c @@ -194,10 +194,7 @@ test_lock_changes(void **state) NC_RPC_EDIT_ERROPT_ROLLBACK, "TestFirst", NC_PARAMTYPE_CONST); st->msgtype = nc_send_rpc(st->nc_sess2, st->rpc, 1000, &st->msgid); assert_int_equal(NC_MSG_RPC, st->msgtype); - st->msgtype = nc_recv_reply(st->nc_sess2, st->rpc, st->msgid, 2000, &st->envp, &st->op); - assert_int_equal(st->msgtype, NC_MSG_REPLY); - assert_null(st->op); - assert_string_equal(LYD_NAME(lyd_child(st->envp)), "rpc-error"); + ASSERT_ERROR_REPLY_SESS2(st); FREE_TEST_VARS(st); } @@ -285,11 +282,7 @@ test_get(void **state) st->rpc = nc_rpc_get(NULL, NC_WD_ALL, NC_PARAMTYPE_CONST); st->msgtype = nc_send_rpc(st->nc_sess, st->rpc, 1000, &st->msgid); assert_int_equal(NC_MSG_RPC, st->msgtype); - st->msgtype = nc_recv_reply(st->nc_sess, st->rpc, st->msgid, 2000, &st->envp, &st->op); - assert_int_equal(st->msgtype, NC_MSG_REPLY); - assert_non_null(st->op); - assert_non_null(st->envp); - + ASSERT_DATA_REPLY(st); FREE_TEST_VARS(st); }