]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
script/ptl-tool: add unit tests for the credential fail-fast fix 70398/head
authorYuri Weinstein <yweinste@redhat.com>
Tue, 21 Jul 2026 16:58:00 +0000 (09:58 -0700)
committerYuri Weinstein <yweinste@redhat.com>
Tue, 21 Jul 2026 16:58:00 +0000 (09:58 -0700)
commitf65b96c09799568f75a0593423c105502bdfb38b
tree44b3fa99f076cf237e4a0eae90068e7f28cb3aaa
parent8bb99f9aeea175d43e997054095d991797bac07f
script/ptl-tool: add unit tests for the credential fail-fast fix

Extract the Redmine auth check added in the previous commit into a
standalone verify_redmine_auth(R) function so it can be unit tested
in isolation, and add src/script/test_ptl_tool.py covering:

- verify_redmine_auth(): invalid key (AuthError), a key that
  authenticates but lacks permission (ForbiddenError), a valid key,
  and confirming unrelated Redmine errors (ServerError) still
  propagate normally rather than being misreported as a credentials
  problem.
- AuditReport.post_consolidated_review(): logs success on 2xx, logs
  an error (rather than failing silently) on a non-2xx GitHub
  response, never calls out to GitHub under --dry-run, and is a
  no-op when the report has no issues to post.

No behavior change to verify_redmine_auth() itself -- this is a pure
extraction plus tests. ptl-tool.py has no existing test suite, so
these are self-contained (mocked Redmine/requests, no network access,
no real git checkout needed) and run with plain pytest; see the
module docstring for the exact invocation.

Signed-off-by: Yuri Weinstein <yweinste@redhat.com>
src/script/ptl-tool.py
src/script/test_ptl_tool.py [new file with mode: 0644]