Coverage for tests / integration / tools / gitleaks / test_options.py: 100%
12 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
1"""Integration tests for GitleaksPlugin.set_options method."""
3from __future__ import annotations
5import shutil
6from collections.abc import Callable
7from typing import TYPE_CHECKING
9import pytest
10from assertpy import assert_that
12if TYPE_CHECKING:
13 from lintro.plugins.base import BaseToolPlugin
15# Skip all tests if gitleaks is not installed
16pytestmark = pytest.mark.skipif(
17 shutil.which("gitleaks") is None,
18 reason="gitleaks not installed",
19)
22@pytest.mark.parametrize(
23 ("option_name", "option_value"),
24 [
25 ("no_git", True),
26 ("no_git", False),
27 ("redact", True),
28 ("redact", False),
29 ("config", "/path/to/config.toml"),
30 ("baseline_path", "/path/to/baseline.json"),
31 ("max_target_megabytes", 50),
32 ],
33 ids=[
34 "no_git_true",
35 "no_git_false",
36 "redact_true",
37 "redact_false",
38 "config_path",
39 "baseline_path",
40 "max_target_megabytes",
41 ],
42)
43def test_set_options(
44 get_plugin: Callable[[str], BaseToolPlugin],
45 option_name: str,
46 option_value: object,
47) -> None:
48 """Verify GitleaksPlugin.set_options correctly sets various options.
50 Tests that plugin options can be set and retrieved correctly.
52 Args:
53 get_plugin: Fixture factory to get plugin instances.
54 option_name: Name of the option to set.
55 option_value: Value to set for the option.
56 """
57 gitleaks_plugin = get_plugin("gitleaks")
58 gitleaks_plugin.set_options(**{option_name: option_value})
59 assert_that(gitleaks_plugin.options.get(option_name)).is_equal_to(option_value)