Blob Blame History Raw
From 7487682e505735f2143ccecfc5e7e0fc2dac37f2 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Mon, 8 May 2017 15:28:20 +0200
Subject: [PATCH 155/160] tests: fix test_pam_preauth_cert_no_logon_name()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently a name is provided for test_pam_preauth_cert_no_logon_name()
so it is not a no-logon-name test. This patch removes the name and adds
the now missing mocked reply manually.

Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
(cherry picked from commit 89ff140d7ab92fce52d6730a7d27c8d73c7d9e4a)
---
 src/tests/cmocka/test_pam_srv.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/tests/cmocka/test_pam_srv.c b/src/tests/cmocka/test_pam_srv.c
index 4d351a3707d2a49604595b728fff7705560c871a..35afbdd81d004236885ee80914771ccb4b8acff4 100644
--- a/src/tests/cmocka/test_pam_srv.c
+++ b/src/tests/cmocka/test_pam_srv.c
@@ -1873,10 +1873,14 @@ void test_pam_preauth_cert_no_logon_name(void **state)
      * Since there is a matching user the upcoming lookup by name will find
      * the user entry. But since we force the lookup by name to go to the
      * backend to make sure the group-membership data is up to date the
-     * backend response has to be mocked twice and the second argument of
-     * mock_input_pam_cert cannot be NULL but must match the user name. */
-    mock_input_pam_cert(pam_test_ctx, "pamuser", NULL, NULL,
+     * backend response has to be mocked twice.
+     * Additionally sss_parse_inp_recv() must be mocked because the cache
+     * request will be done with the username found by the certificate
+     * lookup. */
+    mock_input_pam_cert(pam_test_ctx, NULL, NULL, NULL,
                         test_lookup_by_cert_cb, TEST_TOKEN_CERT, false);
+    mock_account_recv_simple();
+    mock_parse_inp("pamuser", NULL, EOK);
 
     will_return(__wrap_sss_packet_get_cmd, SSS_PAM_PREAUTH);
     will_return(__wrap_sss_packet_get_body, WRAP_CALL_REAL);
-- 
2.9.4