Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
4bb5d14f
Commit
4bb5d14f
authored
Feb 08, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test that we can't write files
parent
9cc43f1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
common/lib/codejail/codejail/tests/test_jailpy.py
+14
-0
No files found.
common/lib/codejail/codejail/tests/test_jailpy.py
View file @
4bb5d14f
"""Test jailpy.py"""
import
textwrap
import
textwrap
import
unittest
import
unittest
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
...
@@ -53,6 +55,18 @@ class TestLimits(unittest.TestCase):
...
@@ -53,6 +55,18 @@ class TestLimits(unittest.TestCase):
self
.
assertNotEqual
(
res
.
status
,
0
)
self
.
assertNotEqual
(
res
.
status
,
0
)
self
.
assertEqual
(
res
.
stdout
,
""
)
self
.
assertEqual
(
res
.
stdout
,
""
)
def
test_cant_write_files
(
self
):
res
=
jailpy
(
dedent
(
"""
\
print "Trying"
with open("mydata.txt", "w") as f:
f.write("hello")
with open("mydata.txt") as f2:
print "Got this:", f2.read()
"""
))
self
.
assertNotEqual
(
res
.
status
,
0
)
self
.
assertEqual
(
res
.
stdout
,
"Trying
\n
"
)
self
.
assertIn
(
"ermission denied"
,
res
.
stderr
)
# TODO: write files
# TODO: write files
# TODO: read network
# TODO: read network
# TODO: fork
# TODO: fork
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment