summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-09-29 14:53:12 +0300
committerKamen Mazdrashki <kamenim@samba.org>2010-10-03 01:24:56 +0300
commit302e1d29d82570ec32fd066bb9038649a67d148b (patch)
tree1d9f67edf5bce33af912448e54accc4b249b25fc /source4
parent6546127b6420361469112325d3ec2e2d19ed864c (diff)
downloadsamba-302e1d29d82570ec32fd066bb9038649a67d148b.tar.gz
samba-302e1d29d82570ec32fd066bb9038649a67d148b.tar.bz2
samba-302e1d29d82570ec32fd066bb9038649a67d148b.zip
s4-python-test: Common implementation for getting environment variable value
Unit-test based python tests require certain input parameters to be set in environment, otherwise they can't be run
Diffstat (limited to 'source4')
-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 bf7c563c4e..7a5c2aa694 100644
--- a/source4/scripting/python/samba/tests/__init__.py
+++ b/source4/scripting/python/samba/tests/__init__.py
@@ -68,6 +68,17 @@ def env_loadparm():
raise Exception("SMB_CONF_PATH not set")
return lp
+def env_get_var_value(var_name):
+ """Returns value for variable in os.environ
+
+ Function throws AssertionError if variable is defined.
+ Unit-test based python tests require certain input params
+ to be set in environment, otherwise they can't be run
+ """
+ assert var_name in os.environ.keys(), "Please supply %s in environment" % var_name
+ return os.environ[var_name]
+
+
cmdline_credentials = None
class RpcInterfaceTestCase(TestCase):