Option C Tools
Loading...
Searching...
No Matches
tests_tools.test_secret_scanner_standalone Namespace Reference

Functions

 test_scanner_importable_without_linter ()
 test_linter_reexport_is_same_object ()
 test_scanner_detects_direct_assignment ()
 test_scanner_ignores_env_lookup ()

Detailed Description

Purpose
-------
OI-514 regression coverage — :func:`check_no_hardcoded_secrets` and the
name-pattern helpers live in :mod:`oct.tools.secret_scanner`; the linter
re-exports them purely for back-compat. The scanner must be reachable
*without* importing :mod:`oct.linter.oct_lint`.

Responsibilities
----------------
- Verify ``oct.tools.secret_scanner`` is importable without loading the
  linter.
- Verify the linter re-export is the same object (identity check).
- Verify the scanner flags secret-shaped name patterns in AST snippets.

Diagnostics
-----------
Domain: TOOLS-TESTS
Levels:
    L2 — test lifecycle
    L3 — assertion details
    L4 — deep tracing

Contracts
---------
- ``oct.tools.secret_scanner.check_no_hardcoded_secrets`` is the canonical
  symbol; :mod:`oct.linter.oct_lint.check_no_hardcoded_secrets` is the
  same object (identity, not just equality).
- The scanner flags direct assignments, dict keys, and default args that
  bind secret-shaped names to string literals.
- The scanner does not import the linter (no circular dependency).

Function Documentation

◆ test_linter_reexport_is_same_object()

tests_tools.test_secret_scanner_standalone.test_linter_reexport_is_same_object ( )
OI-514: linter re-export preserves object identity.

Definition at line 62 of file test_secret_scanner_standalone.py.

◆ test_scanner_detects_direct_assignment()

tests_tools.test_secret_scanner_standalone.test_scanner_detects_direct_assignment ( )
OI-514: ``password = "literal"`` flagged with line number.

Definition at line 71 of file test_secret_scanner_standalone.py.

◆ test_scanner_ignores_env_lookup()

tests_tools.test_secret_scanner_standalone.test_scanner_ignores_env_lookup ( )
OI-514: calls and subscripts are safe — env lookups never flagged.

Definition at line 80 of file test_secret_scanner_standalone.py.

◆ test_scanner_importable_without_linter()

tests_tools.test_secret_scanner_standalone.test_scanner_importable_without_linter ( )
OI-514: the scanner module resolves without importing the linter.

Definition at line 44 of file test_secret_scanner_standalone.py.