From aa841298691dffd1ac0b527eb784928c08547cc2 Mon Sep 17 00:00:00 2001 From: ycoheNvidia <99744138+ycoheNvidia@users.noreply.github.com> Date: Sun, 12 May 2024 13:32:03 +0300 Subject: [PATCH] Updated tacacs test (#123) Fixed https://github.com/sonic-net/sonic-host-services/pull/80 rebase failing newly introduced test from https://github.com/sonic-net/sonic-host-services/pull/106 --- tests/hostcfgd/hostcfgd_tacacs_test.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/hostcfgd/hostcfgd_tacacs_test.py b/tests/hostcfgd/hostcfgd_tacacs_test.py index 9855e69e..c07b961c 100644 --- a/tests/hostcfgd/hostcfgd_tacacs_test.py +++ b/tests/hostcfgd/hostcfgd_tacacs_test.py @@ -51,6 +51,7 @@ def mock_hostcfgd(self, test_data, config_name, op_path, sop_path): hostcfgd.NSS_RADIUS_CONF_TEMPLATE = t_path + "/radius_nss.conf.j2" hostcfgd.PAM_RADIUS_AUTH_CONF_TEMPLATE = t_path + "/pam_radius_auth.conf.j2" hostcfgd.PAM_AUTH_CONF = op_path + "/common-auth-sonic" + hostcfgd.PAM_COMMON_SESS = op_path + "/common-session" hostcfgd.NSS_TACPLUS_CONF = op_path + "/tacplus_nss.conf" hostcfgd.NSS_RADIUS_CONF = op_path + "/radius_nss.conf" hostcfgd.NSS_CONF = op_path + "/nsswitch.conf" @@ -59,10 +60,6 @@ def mock_hostcfgd(self, test_data, config_name, op_path, sop_path): hostcfgd.RADIUS_PAM_AUTH_CONF_DIR = op_path + "/" hostcfgd.LDAP_CONF_TEMPLATE = t_path + "/ldap.conf.j2" hostcfgd.LDAP_CONF = op_path + "/ldap.conf" - # hostcfgd.PAM_LDAP_CONF_TEMPLATE = t_path + "/pam_ldap.conf.j2" - # hostcfgd.PAM_LDAP_CONF = op_path + "/pam_ldap.conf" - # hostcfgd.NSS_LDAP_CONF_TEMPLATE = t_path + "/libnss-ldap.conf.j2" - # hostcfgd.NSS_LDAP_CONF = op_path + "/libnss-ldap.conf" shutil.rmtree( op_path, ignore_errors=True) os.mkdir( op_path) @@ -237,4 +234,5 @@ def test_hostcfgd_delete_config_table(self, test_name, test_data): mock.call(mocked_syslog.LOG_ERR, "['service', 'aaastatsd', 'stop'] - failed: return code - 1, output:\nNone"), mock.call(mocked_syslog.LOG_INFO, "AAA Update: key: DEL, op: DEL, data: {}") ] - mocked_syslog.assert_has_calls(expected) + for expected_call in expected: + assert expected_call in mocked_syslog.mock_calls, f"Expected call {expected_call} not found"