aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Ionite <[email protected]>2023-03-02 16:56:23 -0500
committerGravatar Ionite <[email protected]>2023-03-02 16:56:23 -0500
commit9a2dc79a20feb3a0470a5096455fb826acb1f1b9 (patch)
tree5cec320f9a54447db497755c53c8989762812b53
parentIgnore user uploads in output files, default output to `/home` (diff)
Update unit tests for home output directory
-rw-r--r--tests/test_integration.py6
-rw-r--r--tests/test_nsjail.py6
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/test_integration.py b/tests/test_integration.py
index 01fa657..91b01e6 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -79,11 +79,11 @@ class IntegrationTests(unittest.TestCase):
from mod import lib
print(lib.var)
- with open('output/test.txt', 'w') as f:
+ with open('test.txt', 'w') as f:
f.write('test 1')
- Path('output/dir').mkdir()
- Path('output/dir/test2.txt').write_text('test 2')
+ Path('dir').mkdir()
+ Path('dir/test2.txt').write_text('test 2')
"""
),
},
diff --git a/tests/test_nsjail.py b/tests/test_nsjail.py
index 71405c7..138c68a 100644
--- a/tests/test_nsjail.py
+++ b/tests/test_nsjail.py
@@ -191,12 +191,12 @@ class NsJailTests(unittest.TestCase):
data = "a" * 1024
size = 32 * 1024 * 1024
- with open("output/file", "w") as f:
+ with open("file", "w") as f:
for _ in range((size // 1024) - 5):
f.write(data)
for i in range(100):
- os.symlink("file", f"output/file{i}")
+ os.symlink("file", f"file{i}")
"""
).strip()
@@ -210,7 +210,7 @@ class NsJailTests(unittest.TestCase):
def test_file_write_error(self):
"""Test errors during file write."""
- result = self.nsjail.python3([""], [FileAttachment("output", "hello".encode())])
+ result = self.nsjail.python3([""], [FileAttachment("../dev", "hello".encode())])
self.assertEqual(result.returncode, None)
self.assertEqual(result.stdout, "IsADirectoryError: Failed to create file 'output'.")