Skip to content

Test the action against a mock Teamwork API - #75

Open
marcizhu wants to merge 2 commits into
masterfrom
test-against-mock-teamwork
Open

marcizhu wants to merge 2 commits into
masterfrom
test-against-mock-teamwork

Conversation

@marcizhu

Copy link
Copy Markdown
Member

Stack: 1. #75 tests → 2. #76 bug fixes → 3. #77 link matching → 4. #78 secrets → 5. #79 test mode removal

Summary

CI only ran the action in test mode, which skips every Teamwork request, so nothing checked what the action actually sends. tests/run.sh now runs the real image against a mock Teamwork API for 22 cases, comparing the exit code, errors and every request received with a recorded expected file. Those files capture today's behaviour, bugs included, so the fixes in the next PRs show up as changes to them. CI runs the suite in the existing "Ensure this project runs" job, and curl now runs with -sS because its progress meter made the output differ between runs.

Evidence

  • Before: CI's only check is test mode, which logs Test - Simulate request... and sends nothing.
    After: ./tests/run.sh → All 22 case(s) passed in about 15 seconds, identical across runs. The snapshots already show the bugs the next PRs fix, e.g. tests/cases/task-not-found/expected, where the run carries on after the lookup fails and still passes:

    exit code: 0
    
    GET /projects/api/v1/tasks/9999.json -> 404
    
    POST /tasks/9999/comments.json -> 404
    

🤖 Generated with Claude Code

marcizhu and others added 2 commits October 20, 2026 19:50
Each API call assembled its own curl command line. Route them all through
teamwork::request so the options live in one place.

The helper also passes -sS. curl prints a progress meter when its output
is captured, which filled the logs with timings that change on every
run; -S still shows errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI only ran the action in test mode, where every Teamwork request is
skipped, so nothing checked what the action actually sends.

tests/run.sh builds the image, starts a mock Teamwork API
(tests/mock-teamwork.py) on a private Docker network, and runs each case
in tests/cases the way the GitHub runner would: args built from
action.yml, inputs as INPUT_* env vars. It compares the exit code,
stderr and every request the mock received with the case's expected
file.

The expected files record the current behaviour, bugs included, so the
fixes that follow show up as changes to them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants