1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-09 20:59:11 +03:00

s4/tests: Implement BlackboxTestCase.check_output() method

I am going to need this to check if output is OK (kind of)
This commit is contained in:
Kamen Mazdrashki
2011-02-09 03:01:16 +02:00
parent d0867e5c6c
commit 6b1574636a

View File

@ -132,6 +132,17 @@ class BlackboxTestCase(TestCase):
line = " ".join(parts)
subprocess.check_call(line, shell=True)
def check_output(self, line):
bindir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../bin"))
parts = line.split(" ")
if os.path.exists(os.path.join(bindir, parts[0])):
parts[0] = os.path.join(bindir, parts[0])
line = " ".join(parts)
p = subprocess.Popen(line, stdout=subprocess.PIPE, shell=True, close_fds=True)
retcode = p.wait()
if retcode:
raise subprocess.CalledProcessError(retcode, line)
return p.stdout.read()
def connect_samdb(samdb_url, lp=None, session_info=None, credentials=None,
flags=0, ldb_options=None, ldap_only=False):