[TESTING] Integration test: Gitea API round-trip (create/read/close issue) #13

Open
opened 2026-04-04 16:02:15 +00:00 by bezalel · 0 comments
Owner

Summary

Build an integration test that exercises the full Gitea API lifecycle: create an issue, read it back, add a comment, close it, and verify the final state. This validates that Bezalel's Gitea integration works end-to-end.

Motivation

Unit tests check individual pieces. Integration tests check that the pieces work together. If the Gitea API token expires, permissions change, or the API format changes, this test catches it immediately.

Acceptance Criteria

  • Test file at scripts/tests/test_gitea_integration.py
  • Test performs this full round-trip:
    1. Create an issue with title [TEST] Integration test - {timestamp} and a body
    2. Read the issue back via API and verify title, body, state='open'
    3. Add a comment to the issue: "Automated integration test comment"
    4. Read comments and verify the comment exists
    5. Edit the issue (add a label or change the body)
    6. Close the issue via API
    7. Verify the issue state is 'closed'
    8. Clean up: delete the test issue (or leave closed with a test-artifact label)
  • Test uses pytest and has clear assertions with helpful failure messages
  • Test is tagged with @pytest.mark.integration so it can be run separately
  • Test reads the API token from environment variable, NOT hardcoded
  • Test completes in under 10 seconds
  • Test is idempotent - cleans up after itself even on failure (use pytest fixtures with teardown)
  • Test reports all API response codes for debugging

Implementation Notes

  • Use requests library for HTTP calls
  • Use pytest.fixture with yield for setup/teardown
  • Consider parameterizing to test against multiple repos
  • Add this to CI if/when a CI pipeline exists

Definition of Done

pytest scripts/tests/test_gitea_integration.py -v -m integration passes and validates the complete Gitea API round-trip.

## Summary Build an integration test that exercises the full Gitea API lifecycle: create an issue, read it back, add a comment, close it, and verify the final state. This validates that Bezalel's Gitea integration works end-to-end. ## Motivation Unit tests check individual pieces. Integration tests check that the pieces work together. If the Gitea API token expires, permissions change, or the API format changes, this test catches it immediately. ## Acceptance Criteria - [ ] Test file at `scripts/tests/test_gitea_integration.py` - [ ] Test performs this full round-trip: 1. Create an issue with title `[TEST] Integration test - {timestamp}` and a body 2. Read the issue back via API and verify title, body, state='open' 3. Add a comment to the issue: "Automated integration test comment" 4. Read comments and verify the comment exists 5. Edit the issue (add a label or change the body) 6. Close the issue via API 7. Verify the issue state is 'closed' 8. Clean up: delete the test issue (or leave closed with a `test-artifact` label) - [ ] Test uses pytest and has clear assertions with helpful failure messages - [ ] Test is tagged with `@pytest.mark.integration` so it can be run separately - [ ] Test reads the API token from environment variable, NOT hardcoded - [ ] Test completes in under 10 seconds - [ ] Test is idempotent - cleans up after itself even on failure (use pytest fixtures with teardown) - [ ] Test reports all API response codes for debugging ## Implementation Notes - Use `requests` library for HTTP calls - Use `pytest.fixture` with `yield` for setup/teardown - Consider parameterizing to test against multiple repos - Add this to CI if/when a CI pipeline exists ## Definition of Done `pytest scripts/tests/test_gitea_integration.py -v -m integration` passes and validates the complete Gitea API round-trip.
bezalel self-assigned this 2026-04-04 16:02:15 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bezalel/forge-log#13