From 05585281eb08a7c7d9bd0ee9983f744b9d90032b Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Sun, 1 Nov 2015 12:37:42 +0900 Subject: [PATCH] add test for context update callback for edns_client_subnet_private --- ...tdns_context_set_context_update_callback.h | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/test/check_getdns_context_set_context_update_callback.h b/src/test/check_getdns_context_set_context_update_callback.h index 67bfc928..6cfef0df 100644 --- a/src/test/check_getdns_context_set_context_update_callback.h +++ b/src/test/check_getdns_context_set_context_update_callback.h @@ -365,6 +365,30 @@ } END_TEST + START_TEST (getdns_context_set_context_update_callback_20) + { + /* + * Create a context by calling getdns_context_create() + * Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes + * Call getdns_context_set_edns_client_subnet_private() setting to 1 + * expect: GETDNS_CONTEXT_CODE_EDNS_CLIENT_SUBNET_PRIVATE + */ + struct getdns_context *context = NULL; + CONTEXT_CREATE(TRUE); + + ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn), + GETDNS_RETURN_GOOD, "Return code from getdns_context_set_context_update_callback()"); + + expected_changed_item = GETDNS_CONTEXT_CODE_EDNS_CLIENT_SUBNET_PRIVATE; + + ASSERT_RC(getdns_context_set_edns_client_subnet_private(context, 1), + GETDNS_RETURN_GOOD, "Return code from getdns_context_set_edns_client_subnet_private()"); + + CONTEXT_DESTROY; + + } + END_TEST + Suite * @@ -391,6 +415,7 @@ tcase_add_test(tc_pos, getdns_context_set_context_update_callback_17); tcase_add_test(tc_pos, getdns_context_set_context_update_callback_18); tcase_add_test(tc_pos, getdns_context_set_context_update_callback_19); + tcase_add_test(tc_pos, getdns_context_set_context_update_callback_20); suite_add_tcase(s, tc_pos); return s;