From: Gary Lockyer Date: Mon, 16 Jul 2018 02:38:12 +0000 (+1200) Subject: dsdb group_audit_test: Remove redundant mocking code X-Git-Tag: ldb-1.5.0~185 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6a5346f166ac1a9b03bca76dc40d3645432377df;p=thirdparty%2Fsamba.git dsdb group_audit_test: Remove redundant mocking code Remove a place holder test and unused mocking code. Signed-off-by: Gary Lockyer Reviewed-by: Jeremy Allison Reviewed-by: Andrew Bartlett --- diff --git a/source4/dsdb/samdb/ldb_modules/tests/test_group_audit.c b/source4/dsdb/samdb/ldb_modules/tests/test_group_audit.c index 2c32b658a21..8551dcbf705 100644 --- a/source4/dsdb/samdb/ldb_modules/tests/test_group_audit.c +++ b/source4/dsdb/samdb/ldb_modules/tests/test_group_audit.c @@ -63,34 +63,6 @@ int dsdb_search_one(struct ldb_context *ldb, return g_status; } -/* - * Mocking for audit_log_hr to capture the called parameters - */ -const char *audit_log_hr_prefix = NULL; -const char *audit_log_hr_message = NULL; -int audit_log_hr_debug_class = 0; -int audit_log_hr_debug_level = 0; - -static void audit_log_hr_init(void) -{ - audit_log_hr_prefix = NULL; - audit_log_hr_message = NULL; - audit_log_hr_debug_class = 0; - audit_log_hr_debug_level = 0; -} - -void audit_log_human_text( - const char *prefix, - const char *message, - int debug_class, - int debug_level) -{ - audit_log_hr_prefix = prefix; - audit_log_hr_message = message; - audit_log_hr_debug_class = debug_class; - audit_log_hr_debug_level = debug_level; -} - /* * Test helper to check ISO 8601 timestamps for validity */ @@ -551,60 +523,6 @@ static void test_get_primary_group_dn(void **state) TALLOC_FREE(ctx); } -/* - * Mocking for audit_log_json to capture the called parameters - */ -const char *audit_log_json_prefix = NULL; -struct json_object *audit_log_json_message = NULL; -int audit_log_json_debug_class = 0; -int audit_log_json_debug_level = 0; - -static void audit_log_json_init(void) -{ - audit_log_json_prefix = NULL; - audit_log_json_message = NULL; - audit_log_json_debug_class = 0; - audit_log_json_debug_level = 0; -} - -void audit_log_json( - const char* prefix, - struct json_object* message, - int debug_class, - int debug_level) -{ - audit_log_json_prefix = prefix; - audit_log_json_message = message; - audit_log_json_debug_class = debug_class; - audit_log_json_debug_level = debug_level; -} - -/* - * Mocking for audit_message_send to capture the called parameters - */ -struct imessaging_context *audit_message_send_msg_ctx = NULL; -const char *audit_message_send_server_name = NULL; -uint32_t audit_message_send_message_type = 0; -struct json_object *audit_message_send_message = NULL; - -static void audit_message_send_init(void) { - audit_message_send_msg_ctx = NULL; - audit_message_send_server_name = NULL; - audit_message_send_message_type = 0; - audit_message_send_message = NULL; -} -void audit_message_send( - struct imessaging_context *msg_ctx, - const char *server_name, - uint32_t message_type, - struct json_object *message) -{ - audit_message_send_msg_ctx = msg_ctx; - audit_message_send_server_name = server_name; - audit_message_send_message_type = message_type; - audit_message_send_message = message; -} - static void test_audit_group_json(void **state) { struct ldb_context *ldb = NULL; @@ -703,13 +621,6 @@ static void test_audit_group_json(void **state) } -static void test_place_holder(void **state) -{ - audit_log_json_init(); - audit_log_hr_init(); - audit_message_send_init(); -} - /* * Note: to run under valgrind us: * valgrind --suppressions=test_group_audit.valgrind bin/test_group_audit @@ -720,7 +631,6 @@ static void test_place_holder(void **state) int main(void) { const struct CMUnitTest tests[] = { cmocka_unit_test(test_audit_group_json), - cmocka_unit_test(test_place_holder), cmocka_unit_test(test_get_transaction_id), cmocka_unit_test(test_audit_group_hr), cmocka_unit_test(test_get_parsed_dns),