diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-06-09 15:27:17 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-06-09 15:27:17 +0100 |
commit | 2e588565656d82689fed541a690d2c9a2e545dc1 (patch) | |
tree | 507000bfc47d868b2848a84d659c0c73d4d5d72c /tests/test_all.py | |
parent | b814d929ffba615faab7e7cbd09ecb4a01e2f50c (diff) | |
parent | e961f82127860d8efd3cfd9aa10f2cd4820d74f6 (diff) | |
download | sandboxlib-0.3.0.tar.gz |
Merge branch '0.3.0'0.3.0
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) |