Skip to content

feat(bitbucket): add server-level hook-script management methods - #1653

Merged
gonchik merged 1 commit into
atlassian-api:masterfrom
mrcrysta1:feat/bb-server-hook-scripts-management
Aug 16, 2026
Merged

feat(bitbucket): add server-level hook-script management methods#1653
gonchik merged 1 commit into
atlassian-api:masterfrom
mrcrysta1:feat/bb-server-hook-scripts-management

Conversation

@mrcrysta1

Copy link
Copy Markdown
Contributor

Summary

Adds the four remaining server-level hook-script endpoints for Bitbucket
Data Center (8+), completing the coverage requested in #1554. The
project/repository-level methods already existed; this PR closes the global
management gap:

  • get_hook_script(script_id)GET /rest/api/latest/hook-scripts/{scriptId}
  • get_hook_script_content(script_id)GET /rest/api/latest/hook-scripts/{scriptId}/content (raw body, uses not_json_response=True)
  • update_hook_script(script_id, content, name, hook_type, description=None)PUT /rest/api/latest/hook-scripts/{scriptId} (multipart form, mirrors create_hook_script)
  • delete_hook_script(script_id)DELETE /rest/api/latest/hook-scripts/{scriptId}

Each method follows the existing create_hook_script style: hook_type
validated against PRE/POST, multipart fields passed as tuples, and the
X-Atlassian-Token: no-check header for state-changing requests.

Changes

  • atlassian/bitbucket/__init__.py: 4 new methods next to create_hook_script
  • tests/test_bitbucket_server.py: 6 new tests in TestHookScripts (URLs,
    multipart fields, hook-type validation, not_json_response flag)
  • docs/bitbucket.rst: usage example for the new server-level methods

Validation

  • pytest tests/test_bitbucket_server.py -k HookScript: 9 passed
  • black --check atlassian/bitbucket/__init__.py tests/test_bitbucket_server.py: clean
  • pyflakes: clean

Notes

This work was developed with AI assistance (code generation and tests), and
reviewed by a human before submission.

Add get_hook_script, get_hook_script_content, update_hook_script and
delete_hook_script for Bitbucket Data Center global hook scripts,
completing the server-level endpoints requested in atlassian-api#1554. Includes unit
tests and documentation.
@gonchik
gonchik merged commit 480cb56 into atlassian-api:master Aug 16, 2026
8 of 9 checks passed
@gonchik

gonchik commented Aug 16, 2026

Copy link
Copy Markdown
Member

Thanks @mrcrysta1

@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 59.76%. Comparing base (6f49a1a) to head (c28e4c7).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
atlassian/bitbucket/__init__.py 92.30% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1653      +/-   ##
==========================================
+ Coverage   59.74%   59.76%   +0.02%     
==========================================
  Files         101      101              
  Lines       16868    16881      +13     
  Branches     1746     1748       +2     
==========================================
+ Hits        10077    10089      +12     
  Misses       6393     6393              
- Partials      398      399       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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