Exemple #1
0
 def test_load_module(self):
   hook = sandbox.BuiltinImportHook()
   self.assertRaises(ImportError, hook.load_module, '__builtin__')
Exemple #2
0
 def test_find_module_not_whitelisted(self):
   hook = sandbox.BuiltinImportHook()
   self.assertEqual(hook, hook.find_module('__builtin__'))
Exemple #3
0
 def test_find_module_not_builtin(self):
   hook = sandbox.BuiltinImportHook()
   self.assertIsNone(hook.find_module('httplib'))
Exemple #4
0
 def test_find_module_whitelisted(self):
   hook = sandbox.BuiltinImportHook()
   for name in sandbox._WHITE_LIST_C_MODULES:
     self.assertIsNone(hook.find_module(name))