def install_with_tasks(self): """Return the installation tasks of this module. :returns: list of installation tasks """ return [ ConfigureSELinuxTask(sysroot=conf.target.system_root, selinux_mode=self.selinux), ConfigureFingerprintAuthTask( sysroot=conf.target.system_root, fingerprint_auth_enabled=self.fingerprint_auth_enabled), ConfigureAuthselectTask(sysroot=conf.target.system_root, authselect_options=self.authselect), ConfigureAuthconfigTask(sysroot=conf.target.system_root, authconfig_options=self.authconfig) ]
def test_configure_fingerprint_auth_task(self, execWithRedirect): """Test the configure fingerprint task.""" with tempfile.TemporaryDirectory() as sysroot: authselect_dir = os.path.normpath( sysroot + os.path.dirname(AUTHSELECT_TOOL_PATH)) authselect_path = os.path.normpath(sysroot + AUTHSELECT_TOOL_PATH) pam_so_dir = os.path.normpath(sysroot + os.path.dirname(PAM_SO_PATH)) pam_so_path = os.path.normpath(sysroot + PAM_SO_PATH) pam_so_64_dir = os.path.normpath(sysroot + os.path.dirname(PAM_SO_64_PATH)) pam_so_64_path = os.path.normpath(sysroot + PAM_SO_64_PATH) os.makedirs(pam_so_dir) os.makedirs(pam_so_64_dir) os.makedirs(authselect_dir) # Pam library is missing task = ConfigureFingerprintAuthTask(sysroot=sysroot, fingerprint_auth_enabled=True) task.run() execWithRedirect.assert_not_called() # The authselect command is missing execWithRedirect.reset_mock() os.mknod(pam_so_path) task = ConfigureFingerprintAuthTask(sysroot=sysroot, fingerprint_auth_enabled=True) task.run() execWithRedirect.assert_not_called() os.remove(pam_so_path) # Authselect command and pam library are there execWithRedirect.reset_mock() os.mknod(pam_so_path) os.mknod(authselect_path) task = ConfigureFingerprintAuthTask(sysroot=sysroot, fingerprint_auth_enabled=True) task.run() execWithRedirect.assert_called_once_with(AUTHSELECT_TOOL_PATH, [ "select", "sssd", "with-fingerprint", "with-silent-lastlog", "--force" ], root=sysroot) os.remove(pam_so_path) os.remove(authselect_path) # Authselect command and pam library are there execWithRedirect.reset_mock() os.mknod(pam_so_64_path) os.mknod(authselect_path) task = ConfigureFingerprintAuthTask(sysroot=sysroot, fingerprint_auth_enabled=True) task.run() execWithRedirect.assert_called_once_with(AUTHSELECT_TOOL_PATH, [ "select", "sssd", "with-fingerprint", "with-silent-lastlog", "--force" ], root=sysroot) os.remove(pam_so_64_path) os.remove(authselect_path)