Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
codejail
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
codejail
Commits
c92fa52e
Commit
c92fa52e
authored
Mar 28, 2014
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a unit test against a raw IP address.
parent
15c366f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
codejail/tests/test_jail_code.py
+12
-0
No files found.
codejail/tests/test_jail_code.py
View file @
c92fa52e
...
@@ -248,6 +248,18 @@ class TestLimits(JailCodeHelpers, unittest.TestCase):
...
@@ -248,6 +248,18 @@ class TestLimits(JailCodeHelpers, unittest.TestCase):
self
.
assertEqual
(
res
.
stdout
,
"Reading google
\n
"
)
self
.
assertEqual
(
res
.
stdout
,
"Reading google
\n
"
)
self
.
assertIn
(
"IOError"
,
res
.
stderr
)
self
.
assertIn
(
"IOError"
,
res
.
stderr
)
def
test_cant_use_raw_network
(
self
):
res
=
jailpy
(
code
=
"""
\
import urllib
print "Reading example.com"
u = urllib.urlopen("http://93.184.216.119")
example = u.read()
print len(example)
"""
)
self
.
assertNotEqual
(
res
.
status
,
0
)
self
.
assertEqual
(
res
.
stdout
,
"Reading example.com
\n
"
)
self
.
assertIn
(
"IOError"
,
res
.
stderr
)
def
test_cant_fork
(
self
):
def
test_cant_fork
(
self
):
res
=
jailpy
(
code
=
"""
\
res
=
jailpy
(
code
=
"""
\
import os
import os
...
...
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