Summary
Four GitLab tools have no unit tests under tests/tools/: GitLabCommitsTool, GitLabFileTool, GitLabMRsTool, and GitLabPipelinesTool. An inline test exists at app/integrations/gitlab_test.py (tracked separately by #901) but it only covers the config/integration layer.
Context
The four tools live under app/tools/GitLab*Tool/. They make read-only REST calls to the GitLab API using a token from sources["gitlab"]. Other similar provider tools (GitHub, Bitbucket) provide a good pattern to follow.
What to implement
Create four files:
tests/tools/test_gitlab_commits_tool.py
tests/tools/test_gitlab_file_tool.py
tests/tools/test_gitlab_mrs_tool.py
tests/tools/test_gitlab_pipelines_tool.py
Each file should:
- Contract test — inherit
BaseToolContract from tests/tools/conftest.py
is_available — True when sources["gitlab"] has token and project_id; False otherwise
extract_params — assert the dict correctly maps project_id, token, gitlab_url from sources
run happy path — patch the outgoing HTTP call (via unittest.mock.patch on the httpx or requests call inside app/integrations/gitlab.py) and verify the tool returns available: True with the expected output shape
run error path — simulate a non-200 response or network error and verify a graceful error dict is returned
Acceptance criteria
References
Summary
Four GitLab tools have no unit tests under
tests/tools/:GitLabCommitsTool,GitLabFileTool,GitLabMRsTool, andGitLabPipelinesTool. An inline test exists atapp/integrations/gitlab_test.py(tracked separately by #901) but it only covers the config/integration layer.Context
The four tools live under
app/tools/GitLab*Tool/. They make read-only REST calls to the GitLab API using a token fromsources["gitlab"]. Other similar provider tools (GitHub, Bitbucket) provide a good pattern to follow.What to implement
Create four files:
tests/tools/test_gitlab_commits_tool.pytests/tools/test_gitlab_file_tool.pytests/tools/test_gitlab_mrs_tool.pytests/tools/test_gitlab_pipelines_tool.pyEach file should:
BaseToolContractfromtests/tools/conftest.pyis_available—Truewhensources["gitlab"]hastokenandproject_id;Falseotherwiseextract_params— assert the dict correctly mapsproject_id,token,gitlab_urlfrom sourcesrunhappy path — patch the outgoing HTTP call (viaunittest.mock.patchon the httpx or requests call insideapp/integrations/gitlab.py) and verify the tool returnsavailable: Truewith the expected output shaperunerror path — simulate a non-200 response or network error and verify a graceful error dict is returnedAcceptance criteria
tests/tools/is_available,extract_params, andrun(happy + error paths)make test-covpassesmake lintpassesReferences
tests/tools/test_github_commits_tool.py(closest analogue)app/tools/GitLab*Tool/app/integrations/gitlab.pyapp/integrations/gitlab_test.py(Moveapp/integrations/gitlab_test.pyintotests/integrations/#901)