summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2011-02-09 03:01:16 +0200
committerKamen Mazdrashki <kamenim@samba.org>2011-02-09 11:57:13 +0200
commit6b1574636a8493d043795b7f397657846a637f28 (patch)
treeab8bf4df137df36296d8ebfcbbd402a31828063c /source4/scripting
parentd0867e5c6c164fdd927a7e961d60287a8bd7e9f5 (diff)
downloadsamba-6b1574636a8493d043795b7f397657846a637f28.tar.gz
samba-6b1574636a8493d043795b7f397657846a637f28.tar.bz2
samba-6b1574636a8493d043795b7f397657846a637f28.zip
s4/tests: Implement BlackboxTestCase.check_output() method
I am going to need this to check if output is OK (kind of)
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/tests/__init__.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py
index d0362efb4a..8bb1b0b766 100644
--- a/source4/scripting/python/samba/tests/__init__.py
+++ b/source4/scripting/python/samba/tests/__init__.py
@@ -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):