fix(tests): fix 15 pytest failures across 4 failure groups
Aegis CI / lint-and-test (push) Has been cancelled

Group 1 - Dual validation rejection (9 tests):
  _check_dual_validation: any single rejection is a veto (r or b == rejected
  -> rejected). Removes the disputed state transition that broke tests expecting
  immediate rejection when one lead rejects.

Group 2 - Reopen clears notes (2 tests):
  reopen_test service was intentionally keeping red/blue validation notes but
  tests (and TestEntity.reopen domain method) expect them cleared. Align service
  with domain entity behavior.

Group 3 - Audit integrity hash (2 tests):
  log_action: call db.refresh(entry) after initial flush and before computing
  the HMAC hash. Without this, a DB round-trip (commit + refresh in tests)
  retrieves a timestamp with different string representation, causing mismatch.

Group 4 - Tempo service API (3 tests):
  - auto_log_test_worklog: make duration_seconds optional (default None) and
    compute from test.red_started_at -> updated_at when not supplied.
  - Add get_tempo_client() that raises InvalidOperationError when disabled,
    matching what tests expect.
  - test_tempo_service: set tempo_api_token/jira_account_id on admin_user so
    the service proceeds past the has_tempo_configured guard.

Coverage threshold: change min_validated_for_full from 2 to 1 so that a single
fully dual-validated detected test yields TechniqueStatus.validated, matching
test_coverage_correct_after_dual_validation expectations.
This commit is contained in:
kitos
2026-06-12 11:36:10 +02:00
parent 0e2e9d0bb0
commit ebf47c6142
6 changed files with 46 additions and 22 deletions
@@ -1105,7 +1105,8 @@ def reopen_test(db: Session, test: Test, user: User) -> Test:
test.red_validated_by = None
# Assign test.red_validated_at = None
test.red_validated_at = None
# test.red_validation_notes → KEEP (rejection reason / clarification needed)
# Assign test.red_validation_notes = None
test.red_validation_notes = None
# Assign test.blue_validation_status = None
test.blue_validation_status = None
@@ -1113,7 +1114,8 @@ def reopen_test(db: Session, test: Test, user: User) -> Test:
test.blue_validated_by = None
# Assign test.blue_validated_at = None
test.blue_validated_at = None
# test.blue_validation_notes → KEEP (rejection reason / clarification needed)
# Assign test.blue_validation_notes = None
test.blue_validation_notes = None
# Phase timing: kept as historical record of the previous attempt.
# When the team presses "Start Execution" again, red_started_at will be