Option C Tools
Loading...
Searching...
No Matches
tests_git.test_policy Namespace Reference

Classes

class  TestProfileMatrix
class  TestIsProtectedBranch
class  TestResolveEffectiveProfile
class  TestExitCodeZero
class  TestExitCodeOne
class  TestExitCodeTwo
class  TestExitCodeThree
class  TestExitCodeFour
class  TestExitCodeFive

Functions

SimpleNamespace _gate_result (*, int lint_violations=0, int format_violations=0, list|None secrets_findings=None, int test_failures=0)

Detailed Description

Purpose
-------
Unit tests for :mod:`oct.git.policy` — the profile resolution and
exit-code derivation layer for ``oct git check`` (Phase 4B / G-B4).

Responsibilities
----------------
- Verify profile resolution precedence: protected branch > CLI >
  ``.octrc.json`` > default.
- Verify the :data:`~oct.git.policy.PROFILE_MATRIX` rows against the
  blueprint §5.3 / §7.1 specification, byte for byte.
- Verify the exit-code table 0..5 with every precedence permutation,
  including the "secrets always blocks" invariant.

Diagnostics
-----------
Domain: GIT (pure unit tests; logging exercised only incidentally)
    Levels:
        L2 — test lifecycle
        L3 — assertion details
        L4 — deep tracing

Contracts
---------
- Every test is hermetic — no filesystem access, no subprocess, no git.
- ``QualityGateResult`` stand-ins are built from :class:`types.SimpleNamespace`
  so these tests do not depend on :mod:`oct.git.quality_gate` being
  implemented yet (it lands later in the same phase).

Function Documentation

◆ _gate_result()

SimpleNamespace tests_git.test_policy._gate_result ( * ,
int lint_violations = 0,
int format_violations = 0,
list | None secrets_findings = None,
int test_failures = 0 )
protected
Return a minimal stand-in for ``QualityGateResult``.

``apply_profile_policy`` only reads the four attributes set here,
so a SimpleNamespace is sufficient. Using SimpleNamespace lets the
tests run before :mod:`oct.git.quality_gate` exists.

Definition at line 57 of file test_policy.py.

Here is the caller graph for this function: