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

Functions

 test_scan_flags_password_literal ()
 test_scan_flags_api_key ()
 test_scan_ignores_non_secret_names ()
 test_scan_ignores_short_values ()
 test_scan_line_numbers_correct ()
Path _make_minimal_project (Path tmp_path, str file_name, str content)
 test_run_exporter_warns_on_hardcoded_secret (tmp_path, capsys)
 test_run_exporter_no_warn_by_default_without_flag (tmp_path, capsys)
 test_run_exporter_block_secrets_skips_file (tmp_path, capsys)

Detailed Description

Purpose
-------
Tests for content-level secret scanning (OI-416) in ``oct.tools.source_exporter``.

Responsibilities
----------------
- Verify ``_scan_content_for_secrets`` flags likely secret assignments.
- Verify non-secret assignments are not flagged.
- Verify ``run_exporter`` emits warnings when ``--warn-secrets`` is on.
- Verify ``--block-secrets`` excludes files with potential secrets from
  the exported content.

Diagnostics
-----------
Domain: OCT-TEST
L2: test lifecycle
L3: assertion details
L4: deep tracing

Contracts
---------
Inputs:  tmp_path fixtures
Outputs: pass/fail assertions

Function Documentation

◆ _make_minimal_project()

Path tests_tools.test_source_exporter._make_minimal_project ( Path tmp_path,
str file_name,
str content )
protected
Create a minimal Option C project layout with one python file.

Definition at line 87 of file test_source_exporter.py.

Here is the caller graph for this function:

◆ test_run_exporter_block_secrets_skips_file()

tests_tools.test_source_exporter.test_run_exporter_block_secrets_skips_file ( tmp_path,
capsys )

Definition at line 121 of file test_source_exporter.py.

Here is the call graph for this function:

◆ test_run_exporter_no_warn_by_default_without_flag()

tests_tools.test_source_exporter.test_run_exporter_no_warn_by_default_without_flag ( tmp_path,
capsys )

Definition at line 111 of file test_source_exporter.py.

Here is the call graph for this function:

◆ test_run_exporter_warns_on_hardcoded_secret()

tests_tools.test_source_exporter.test_run_exporter_warns_on_hardcoded_secret ( tmp_path,
capsys )

Definition at line 97 of file test_source_exporter.py.

Here is the call graph for this function:

◆ test_scan_flags_api_key()

tests_tools.test_source_exporter.test_scan_flags_api_key ( )

Definition at line 51 of file test_source_exporter.py.

Here is the call graph for this function:

◆ test_scan_flags_password_literal()

tests_tools.test_source_exporter.test_scan_flags_password_literal ( )

Definition at line 43 of file test_source_exporter.py.

Here is the call graph for this function:

◆ test_scan_ignores_non_secret_names()

tests_tools.test_source_exporter.test_scan_ignores_non_secret_names ( )

Definition at line 58 of file test_source_exporter.py.

Here is the call graph for this function:

◆ test_scan_ignores_short_values()

tests_tools.test_source_exporter.test_scan_ignores_short_values ( )
Very short values (< 4 chars) don't look like real secrets.

Definition at line 64 of file test_source_exporter.py.

Here is the call graph for this function:

◆ test_scan_line_numbers_correct()

tests_tools.test_source_exporter.test_scan_line_numbers_correct ( )

Definition at line 71 of file test_source_exporter.py.

Here is the call graph for this function: