client-python
client-python copied to clipboard
"get_config_variable" would not raise ValueError with required = True, if env_var is not set and config dict is empty
Description
def test_get_opencti_client_missing_url(self):
"""Test client creation with missing URL."""
sample_config = {}
with pytest.raises(ValueError, match="The configuration OPENCTI_URL is required"):
get_config_variable("OPENCTI_URL", ["opencti", "url"], sample_config, required=True)
will test failed Failed: DID NOT RAISE <class 'ValueError'>
Environment
- Mac OS 15.5
- OpenCTI version: OpenCTI 6.6.12
Reproducible Steps
Steps to create the smallest reproducible scenario: run unit test with get_config_variable
def test_get_opencti_client_missing_url(self):
"""Test client creation with missing URL."""
sample_config = {}
with pytest.raises(ValueError, match="The configuration OPENCTI_URL is required"):
get_config_variable("OPENCTI_URL", ["opencti", "url"], sample_config, required=True)
Expected Output
raise ValueError "The configuration OPENCTI_URL is required"
Actual Output
get None
Additional information
N/A