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
fb27d0a5
Commit
fb27d0a5
authored
May 16, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More pylint happiness
parent
5af6e16a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
codejail/tests/test_jailpy.py
+7
-3
No files found.
codejail/tests/test_jailpy.py
View file @
fb27d0a5
...
@@ -33,11 +33,13 @@ class JailCodeHelpers(object):
...
@@ -33,11 +33,13 @@ class JailCodeHelpers(object):
def
assertResultOk
(
self
,
res
):
def
assertResultOk
(
self
,
res
):
"""Assert that `res` exited well (0), and had no stderr output."""
"""Assert that `res` exited well (0), and had no stderr output."""
self
.
assertEqual
(
res
.
stderr
,
""
)
self
.
assertEqual
(
res
.
stderr
,
""
)
# pylint: disable=E1101
self
.
assertEqual
(
res
.
status
,
0
)
self
.
assertEqual
(
res
.
status
,
0
)
# pylint: disable=E1101
class
TestFeatures
(
JailCodeHelpers
,
unittest
.
TestCase
):
class
TestFeatures
(
JailCodeHelpers
,
unittest
.
TestCase
):
"""Test features of how `jail_code` runs Python."""
def
test_hello_world
(
self
):
def
test_hello_world
(
self
):
res
=
jailpy
(
code
=
"print 'Hello, world!'"
)
res
=
jailpy
(
code
=
"print 'Hello, world!'"
)
self
.
assertResultOk
(
res
)
self
.
assertResultOk
(
res
)
...
@@ -68,7 +70,7 @@ class TestFeatures(JailCodeHelpers, unittest.TestCase):
...
@@ -68,7 +70,7 @@ class TestFeatures(JailCodeHelpers, unittest.TestCase):
stdin
=
"[1, 2.5, 33]"
stdin
=
"[1, 2.5, 33]"
)
)
self
.
assertResultOk
(
res
)
self
.
assertResultOk
(
res
)
self
.
assertEqual
(
res
.
stdout
.
strip
(),
"36.5
"
)
self
.
assertEqual
(
res
.
stdout
,
"36.5
\n
"
)
def
test_files_are_copied
(
self
):
def
test_files_are_copied
(
self
):
res
=
jailpy
(
res
=
jailpy
(
...
@@ -273,6 +275,8 @@ class TestSymlinks(JailCodeHelpers, unittest.TestCase):
...
@@ -273,6 +275,8 @@ class TestSymlinks(JailCodeHelpers, unittest.TestCase):
class
TestMalware
(
JailCodeHelpers
,
unittest
.
TestCase
):
class
TestMalware
(
JailCodeHelpers
,
unittest
.
TestCase
):
"""Tests that attempt actual malware against the interpreter or system."""
def
test_crash_cpython
(
self
):
def
test_crash_cpython
(
self
):
# http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
# http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
res
=
jailpy
(
code
=
"""
\
res
=
jailpy
(
code
=
"""
\
...
...
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