Commit c92fa52e by Ned Batchelder

Add a unit test against a raw IP address.

parent 15c366f0
...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment