Skip to content

test: move live API probe out of unit discovery - #4

Open
djbclark wants to merge 1 commit into
sidinsearch:mainfrom
djbclark:dpr/test-live-api-isolation
Open

test: move live API probe out of unit discovery#4
djbclark wants to merge 1 commit into
sidinsearch:mainfrom
djbclark:dpr/test-live-api-isolation

Conversation

@djbclark

@djbclark djbclark commented Jul 31, 2026

Copy link
Copy Markdown

Why this is useful

Backend test discovery should be safe to run in a fresh checkout and in CI. The existing backend/tests/test_api.py performs a credentialed request to a live /recent endpoint as soon as the file is imported, so discovering the test suite can fail before any real test runs unless a local server and runtime token happen to be available.

This change keeps test discovery deterministic and offline while preserving the live-server check as an explicit diagnostic command. Contributors can run the test suite without hidden runtime prerequisites, and operators still have a clearer probe with a configurable server URL, bounded timeout, and meaningful exit status.

Summary

  • Move the manual /recent API probe from backend/tests/ to backend/scripts/check_api.py.
  • Keep network access, the runtime token, and a running server out of unit-test discovery.
  • Add an explicit base-URL option, request timeout, and nonzero exit status for unsuccessful responses.

Verification

  • python3 -m compileall -q backend/scripts/check_api.py
  • python3 backend/scripts/check_api.py --help
  • PYTHONPATH=backend <project-python> backend/tests/test_access_token.py — all five existing API authentication checks passed.
  • Final branch is one commit ahead of current upstream main, with only the two expected files changed.

Roadmap FYI

The broader plan for small SuperBrain contributions that do not depend on YouTube approving enhanced YouTube Data API access, including increased quota, is tracked in djbclark/superbrain#3. These contributions may support YouTube-related workflows, but OAuth subscription discovery, YouTube playlist management and backfill, and other approval-dependent API work are explicitly excluded from this PR and held back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant