summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-07-01 20:36:56 +0000
committerGerrit Code Review <review@openstack.org>2013-07-01 20:36:56 +0000
commit262d6a5f53e1ecfdcf7f605e011b9985fcd62822 (patch)
tree87e5a565359422671cb904be44286d128e29fb91 /tests
parentfb50f51f06b7429e8ca1f6247713e9fed0ee7bc2 (diff)
parent233baa20f5f7c83c20c410da10861ea0fa6a0307 (diff)
downloadoslo-262d6a5f53e1ecfdcf7f605e011b9985fcd62822.tar.gz
oslo-262d6a5f53e1ecfdcf7f605e011b9985fcd62822.tar.xz
oslo-262d6a5f53e1ecfdcf7f605e011b9985fcd62822.zip
Merge "Handle empty PATH environment variable"
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_rootwrap.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/unit/test_rootwrap.py b/tests/unit/test_rootwrap.py
index 02789ec..6e1e6e6 100644
--- a/tests/unit/test_rootwrap.py
+++ b/tests/unit/test_rootwrap.py
@@ -178,8 +178,9 @@ class RootwrapTestCase(utils.BaseTestCase):
# Filter shouldn't be able to find binary in $PATH, so fail
with fixtures.EnvironmentVariable("PATH", "/foo:/bar"):
self.assertFalse(f.match(usercmd))
- pass
-
+ # ensure that unset $PATH is not causing an exception
+ with fixtures.EnvironmentVariable("PATH"):
+ self.assertFalse(f.match(usercmd))
finally:
# Terminate the "cat" process and wait for it to finish
p.terminate()
@@ -314,6 +315,11 @@ class RootwrapTestCase(utils.BaseTestCase):
config = wrapper.RootwrapConfig(raw)
self.assertEqual(config.filters_path, ['/a', '/b'])
self.assertEqual(config.exec_dirs, os.environ["PATH"].split(':'))
+
+ with fixtures.EnvironmentVariable("PATH"):
+ c = wrapper.RootwrapConfig(raw)
+ self.assertEqual(c.exec_dirs, [])
+
self.assertFalse(config.use_syslog)
self.assertEqual(config.syslog_log_facility,
logging.handlers.SysLogHandler.LOG_SYSLOG)