def test_configure_legacy_jail(self): codejail_setting = FakeJailSettings({ 'python_bin': '/usr/bin/python', 'user': '******', }) django_integration.configure_from_settings(codejail_setting) codejail = jail.get_codejail('python') self.assertEqual(codejail.command, 'python') self.assertEqual(codejail.bin_path, '/usr/bin/python') self.assertEqual(codejail.user, 'abc') self.assertEqual(codejail.lang, languages.python2)
def test_configure_legacy_jail(self): codejail_setting = FakeJailSettings({ 'python_bin': '/usr/bin/python', 'user': '******', }) django_integration.configure_from_settings(codejail_setting) codejail = jail.get_codejail('python') self.assertEqual(codejail.command, 'python') self.assertEqual(codejail.bin_path, '/usr/bin/python') self.assertEqual(codejail.user, 'abc') self.assertEqual(codejail.lang, languages.python2)
def test_safe_exec_unconfigured(self): with helpers.override_configuration('python3', lang=languages.other): jail = get_codejail('python3') with self.assertRaises(JailError): jail.safe_exec('print("hello")', {})
def test_safe_exec_unconfigured(self): with helpers.override_configuration('python3', lang=languages.other): jail = get_codejail('python3') with self.assertRaises(JailError): jail.safe_exec('print("hello")', {})