aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_nsjail.py
diff options
context:
space:
mode:
authorGravatar ionite34 <[email protected]>2022-11-24 11:59:33 +0800
committerGravatar ionite34 <[email protected]>2022-11-24 11:59:33 +0800
commit8f101080828c3aa752995a107646b6b548827f67 (patch)
tree84ab1d1a5e4e68144f9a7fd786c45e1678b64ae5 /tests/test_nsjail.py
parentAdd unit test for MemFS access before __enter__ (diff)
Add request file IO error handling
Diffstat (limited to 'tests/test_nsjail.py')
-rw-r--r--tests/test_nsjail.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_nsjail.py b/tests/test_nsjail.py
index d63180d..127753e 100644
--- a/tests/test_nsjail.py
+++ b/tests/test_nsjail.py
@@ -207,6 +207,14 @@ class NsJailTests(unittest.TestCase):
)
self.assertEqual(result.stderr, None)
+ def test_file_write_error(self):
+ """Test errors during file write."""
+ result = self.nsjail.python3([""], [FileAttachment("output", "hello")])
+
+ self.assertEqual(result.returncode, None)
+ self.assertEqual(result.stdout, "IsADirectoryError: Failed to create file 'output'.")
+ self.assertEqual(result.stderr, None)
+
def test_sigsegv_returns_139(self): # In honour of Juan.
code = dedent(
"""