diff options
Diffstat (limited to 'tests/test_all.py')
-rw-r--r-- | tests/test_all.py | 34 |
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) |