[Quality] Add Mock Integration Tests Emulating Gitea API Responses for Loop Scripts #1429

Closed
opened 2026-03-24 13:04:47 +00:00 by Timmy · 1 comment
Owner

Context: Shell scripts manipulating API paths currently possess zero formal testing.

Acceptance Criteria:

  • Develop Python mock boundaries executing .sh flows within temporary subshells to assert logic coverage.
  • Eliminate 'push-and-pray' architectural deployment.
**Context:** Shell scripts manipulating API paths currently possess zero formal testing. **Acceptance Criteria:** - Develop Python mock boundaries executing `.sh` flows within temporary subshells to assert logic coverage. - Eliminate 'push-and-pray' architectural deployment.
Author
Owner

Implementation Instructions

Kimi, please implement mock integration tests for our shell scripts that manipulate Gitea API paths.

Step-by-step approach:

  1. Create tests/integration/test_loop_scripts.py
  2. Use unittest.mock to mock HTTP responses from Gitea API
  3. Focus on these critical scripts:
    • agent-dispatch.sh
    • hermes-claim.sh
    • kimi-loop.sh

Key test scenarios:

  • API success responses (200)
  • API error responses (401, 404, 500)
  • Network timeouts
  • Malformed JSON responses

Testing pattern:

with patch("requests.get") as mock_get:
    mock_get.return_value = Mock(status_code=200, json=lambda: {...})
    result = subprocess.run(["./agent-dispatch.sh", "arg"], capture_output=True)
    assert result.returncode == 0

Acceptance criteria:

  • Tests run with tox -e integration
  • Cover happy path and error scenarios
  • Use temporary directories for any file operations
  • Mock all external API calls
## Implementation Instructions Kimi, please implement mock integration tests for our shell scripts that manipulate Gitea API paths. **Step-by-step approach:** 1. Create `tests/integration/test_loop_scripts.py` 2. Use `unittest.mock` to mock HTTP responses from Gitea API 3. Focus on these critical scripts: - `agent-dispatch.sh` - `hermes-claim.sh` - `kimi-loop.sh` **Key test scenarios:** - API success responses (200) - API error responses (401, 404, 500) - Network timeouts - Malformed JSON responses **Testing pattern:** ```python with patch("requests.get") as mock_get: mock_get.return_value = Mock(status_code=200, json=lambda: {...}) result = subprocess.run(["./agent-dispatch.sh", "arg"], capture_output=True) assert result.returncode == 0 ``` **Acceptance criteria:** - Tests run with `tox -e integration` - Cover happy path and error scenarios - Use temporary directories for any file operations - Mock all external API calls
kimi was assigned by Timmy 2026-03-24 13:21:51 +00:00
kimi was unassigned by Timmy 2026-03-24 19:32:12 +00:00
Timmy closed this issue 2026-03-24 21:54:04 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1429