Coverage for tests / integration / tools / gitleaks / test_definition.py: 100%
18 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 definition attributes."""
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 ("attr", "expected"),
24 [
25 ("name", "gitleaks"),
26 ("can_fix", False),
27 ],
28 ids=["name", "can_fix"],
29)
30def test_definition_attributes(
31 get_plugin: Callable[[str], BaseToolPlugin],
32 attr: str,
33 expected: object,
34) -> None:
35 """Verify GitleaksPlugin definition has correct attribute values.
37 Args:
38 get_plugin: Fixture factory to get plugin instances.
39 attr: The attribute name to check on the definition.
40 expected: The expected value of the attribute.
41 """
42 gitleaks_plugin = get_plugin("gitleaks")
43 assert_that(getattr(gitleaks_plugin.definition, attr)).is_equal_to(expected)
46def test_definition_file_patterns(
47 get_plugin: Callable[[str], BaseToolPlugin],
48) -> None:
49 """Verify GitleaksPlugin definition scans all files.
51 Args:
52 get_plugin: Fixture factory to get plugin instances.
53 """
54 gitleaks_plugin = get_plugin("gitleaks")
55 assert_that(gitleaks_plugin.definition.file_patterns).contains("*")
58def test_definition_tool_type(
59 get_plugin: Callable[[str], BaseToolPlugin],
60) -> None:
61 """Verify GitleaksPlugin is a security tool type.
63 Args:
64 get_plugin: Fixture factory to get plugin instances.
65 """
66 from lintro.enums.tool_type import ToolType
68 gitleaks_plugin = get_plugin("gitleaks")
69 assert_that(gitleaks_plugin.definition.tool_type).is_equal_to(ToolType.SECURITY)