Skip to content

Commit 8b5bcd3

Browse files
test: add coverage for allow_self_signed config deprecation warning
Add test to verify that the deprecation warning is properly added to deprecation_messages when allow_self_signed is used in config files. This brings the patch coverage to 100%. Issue: SCRT-5952
1 parent 0855177 commit 8b5bcd3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/unit/core/config/test_user_config.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,26 @@ def test_can_load_ignored_known_secrets_from_secret(self, local_config_path):
294294
config, _ = UserConfig.load(local_config_path)
295295
assert config.secret.ignore_known_secrets
296296

297+
def test_allow_self_signed_deprecation_warning(self, local_config_path):
298+
"""
299+
GIVEN a config file containing allow_self_signed: true
300+
WHEN loading the config
301+
THEN a deprecation warning is added to deprecation_messages
302+
"""
303+
write_yaml(
304+
local_config_path,
305+
{
306+
"version": 2,
307+
"allow_self_signed": True,
308+
},
309+
)
310+
config, _ = UserConfig.load(local_config_path)
311+
assert config.allow_self_signed is True
312+
assert len(config.deprecation_messages) == 1
313+
assert "allow_self_signed" in config.deprecation_messages[0]
314+
assert "deprecated" in config.deprecation_messages[0]
315+
assert "insecure" in config.deprecation_messages[0]
316+
297317
def test_bad_local_config(self, local_config_path, global_config_path):
298318
"""
299319
GIVEN a malformed .gitguardian.yaml, with a list of instance

0 commit comments

Comments
 (0)