File tree Expand file tree Collapse file tree
xblocks_contrib/problem/capa/safe_exec/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99import pytest
1010import random2 as random
1111from codejail .safe_exec import SafeExecException
12+ from django .core .exceptions import ImproperlyConfigured
13+ from django .test import override_settings
1214from six import unichr
1315
1416from xblocks_contrib .problem .capa .safe_exec import safe_exec , update_hash
@@ -42,6 +44,12 @@ def make_python_library_zip_bytes():
4244class TestSafeExec (unittest .TestCase ):
4345 """Unit tests for verifying functionality and restrictions of safe_exec."""
4446
47+ @override_settings (ENABLE_CODEJAIL_REST_SERVICE = False )
48+ def test_safe_exec_requires_remote_service (self ):
49+ """Verify safe_exec raises ImproperlyConfigured when remote service is disabled."""
50+ with pytest .raises (ImproperlyConfigured ):
51+ safe_exec ("a = 1" , {})
52+
4553 def test_set_values (self ):
4654 """Verify assignment of values in safe_exec."""
4755 g = {}
You can’t perform that action at this time.
0 commit comments