diff options
| author | 2024-10-03 22:15:06 +0100 | |
|---|---|---|
| committer | 2024-10-03 22:15:06 +0100 | |
| commit | 3e3dfa003425e2d3114cd29e554e1b9ebce73565 (patch) | |
| tree | d0eec56f783befe7024ca637aabdb990cff99dbe /tests | |
| parent | Update all references to /lang to /snekbin (diff) | |
Update invalid binary paths test to cover new error handling
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_integration.py | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/tests/test_integration.py b/tests/test_integration.py index 7935b6d..62a7d69 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -85,19 +85,19 @@ class IntegrationTests(unittest.TestCase):          """Test that passing invalid binary paths result in no code execution."""          with run_gunicorn():              cases = [ -                ("/bin/bash", "test files outside of /snekbin cannot be run"), +                ("/abc/def", "test non-existant files are not run", "binary_path does not exist"), +                ("/snekbin", "test directories are not ran", "binary_path is not a file"),                  ( -                    "/snekbin/../bin/bash", -                    "test path traversal still stops files outside /snekbin from running", +                    "/etc/hostname", +                    "test non-executable files are not ran", +                    "binary_path is not executable",                  ), -                ("/foo/bar", "test non-existant files are not run"),              ] -            for path, msg in cases: -                with self.subTest(msg=msg, path=path): +            for path, msg, expected in cases: +                with self.subTest(msg=msg, path=path, expected=expected):                      body = {"args": ["-c", "echo", "hi"], "binary_path": path}                      response, status = snekbox_request(body)                      self.assertEqual(status, 400) -                    expected = {"title": "binary_path file is invalid"}                      self.assertEqual(json.loads(response)["stdout"], expected)      def test_eval(self): | 
