You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using _get_paged with the pullrequest.comments property, query parameters are not supported.
Desired query: https://api.bitbucket.org/2.0/repositories/WORKSPACE/REPOSITORY/pullrequests/PR_ID/comments?q=deleted=false
Actual query: https://api.bitbucket.org/2.0/repositories/WORKSPACE/REPOSITORY/pullrequests/PR_ID/comments
Desired result: All Comment objects where deleted == False
Actual result: All Comment objects.
Steps to reproduce:
# set up initial state
cloud = Cloud(username=USERNAME, password=APP_PASSWORD, cloud=True)
workspace = cloud.workspaces.get(WORKSPACE)
repository = cloud.repositories.get(WORKSPACE, REPOSITORY)
pull_request = repository.pullrequests.get(id=PULL_REQUEST_ID)
# add 6 comments to target PR, delete 3 comments
(steps TBA; I did this manually inside the PR)
# call the original function and save the result
comments = list(pull_request.comments())
# print status of found comments. Should be mix of "True" and "False," 3 of each
[print(comment.data["deleted"]) for comment in comments]
True
True
True
False
False
False
### adding the feature and verifying functionality
# patch atlassian.bitbucket.cloud.repositories.pullRequests.PullRequest:comments to properly handle query parameters
# code changes follow the implementation of PullRequests.each, which already supports a query string
def comments(q=None):
params = {}
if q is not None:
params["q"] = q
for comment in pull_request._get_paged("comments", params=params):
yield Comment(comment, **pull_request._new_session_args)
# reimport module and run the same function again, passing in a value for q:
comments = list(pull_request.comments(q="deleted=false"))
# Final output:
[print(comment.data["deleted"]) for comment in comments]
False
False
False
The text was updated successfully, but these errors were encountered:
markarce
changed the title
AtlassianRestAPI: request.get does not properly handle query parameters
[BitBucket Cloud] PullRequests.comments property does not properly handle query parameters
Dec 17, 2022
When using
_get_paged
with thepullrequest.comments
property, query parameters are not supported.Desired query:
https://api.bitbucket.org/2.0/repositories/WORKSPACE/REPOSITORY/pullrequests/PR_ID/comments?q=deleted=false
Actual query:
https://api.bitbucket.org/2.0/repositories/WORKSPACE/REPOSITORY/pullrequests/PR_ID/comments
Desired result: All
Comment
objects wheredeleted
==False
Actual result: All
Comment
objects.Steps to reproduce:
The text was updated successfully, but these errors were encountered: