summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-06-09 12:32:02 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-06-09 12:32:02 +0100
commitb89b44ca72a2ae83ab0eb6435831d78199f4da24 (patch)
treebebca887dc7f27c0b01a11f1bbc5c46cca08509f
parent7cc1117b3fb56fc6958570f6abe893f6cbb9335c (diff)
downloadsandboxlib-b89b44ca72a2ae83ab0eb6435831d78199f4da24.tar.gz
Add some more tests0.3.0
-rw-r--r--tests/test_all.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/test_all.py b/tests/test_all.py
index 38370f9..eed2f79 100644
--- a/tests/test_all.py
+++ b/tests/test_all.py
@@ -36,6 +36,21 @@ def sandboxlib_executor(request):
return executor
+def test_no_output(sandboxlib_executor):
+ '''Test ignoring of stderr/stdout.
+
+ We could use run_sandbox_with_redirection() and not get the 'err' and 'out'
+ paramemter at all, but we may as well test that they are indeed None.
+
+ '''
+ exit, out, err = sandboxlib_executor.run_sandbox(
+ ['echo', 'xyzzy'], stdout=None, stderr=None)
+
+ assert exit == 0
+ assert out is None
+ assert err is None
+
+
def test_stdout(sandboxlib_executor):
exit, out, err = sandboxlib_executor.run_sandbox(['echo', 'xyzzy'])
@@ -87,7 +102,6 @@ class TestMounts(object):
assert exit == 0
-
class TestWriteablePaths(object):
@pytest.fixture()
def writable_paths_test_sandbox(self, tmpdir,
@@ -182,3 +196,21 @@ class TestWriteablePaths(object):
assert out.decode('unicode-escape') == \
"Wrote data to /data/1/canary."
assert exit == 0
+
+
+def test_executor_for_platform():
+ '''Simple test of backend autodetection.'''
+ executor = sandboxlib.executor_for_platform()
+ test_stdout(executor)
+
+
+def test_degrade_config_for_capabilities(sandboxlib_executor):
+ '''Simple test of adjusting configuration for a given backend.'''
+ in_config = {
+ 'mounts': 'isolated',
+ 'network': 'isolated',
+ 'filesystem_writable_paths': ['/tmp']
+ }
+
+ out_config = sandboxlib_executor.degrade_config_for_capabilities(
+ in_config, warn=True)