From be7e7de999f93f57bfccdeeabcb8682d1e92023a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 16 Mar 2018 19:00:52 +0100 Subject: [PATCH 05/15] TESTS: Move get_call_output() to util.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function will be reused outside of test_sssctl.py. Related: https://pagure.io/SSSD/sssd/issue/3658 Signed-off-by: Fabiano FidĂȘncio Reviewed-by: Jakub Hrozek --- src/tests/intg/test_sssctl.py | 9 +-------- src/tests/intg/util.py | 7 +++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tests/intg/test_sssctl.py b/src/tests/intg/test_sssctl.py index 0df5d0bc1..e8861dd86 100644 --- a/src/tests/intg/test_sssctl.py +++ b/src/tests/intg/test_sssctl.py @@ -28,7 +28,7 @@ import signal import ds_openldap import ldap_ent import config -from util import unindent +from util import unindent, get_call_output import sssd_netgroup LDAP_BASE_DN = "dc=example,dc=com" @@ -203,13 +203,6 @@ def fqname_case_insensitive_rfc2307(request, ldap_conn): return None -def get_call_output(cmd): - process = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - output, ret = process.communicate() - return output.decode('utf-8') - - def test_user_show_basic_sanity(ldap_conn, sanity_rfc2307, portable_LC_ALL): # Fill the cache first ent.assert_passwd_by_name( diff --git a/src/tests/intg/util.py b/src/tests/intg/util.py index 2b40311bd..a1c439648 100644 --- a/src/tests/intg/util.py +++ b/src/tests/intg/util.py @@ -78,3 +78,10 @@ def restore_envvar_file(name): path = os.environ[name] backup_path = path + ".bak" os.rename(backup_path, path) + + +def get_call_output(cmd): + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + output, ret = process.communicate() + return output.decode('utf-8') -- 2.14.3