Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion atlassian/bamboo.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ def get_vcs_branches(self, plan_key, max_results=25):
:return:
"""
resource = 'plan/{plan_key}/vcsBranches'.format(plan_key=plan_key)
return self.base_list_call(resource, start_index=0, max_results=max_results)
return self.base_list_call(resource, start_index=0, max_results=max_results, clover_enabled=None, expand=None,
favourite=None)

""" Build results """

Expand Down
8 changes: 4 additions & 4 deletions atlassian/bitbucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,8 @@ def update_pull_request_comment(self, project, repository, pull_request_id, comm
that must match the server's version of the comment
or the update will fail.
"""
url = "rest/api/1.0/projects/{project}/repos/{repository}/pull-requests/{pull_request_id}/comments/{comment_id}".format(
project=project, repository=repository, pull_request_id=pull_request_id, comment_id=comment_id
url = 'rest/api/1.0/projects/{project}/repos/{repo}/pull-requests/{pull_request}/comments/{comment_id}'.format(
project=project, repo=repository, pull_request=pull_request_id, comment_id=comment_id
)
payload = {
"version": comment_version,
Expand Down Expand Up @@ -852,8 +852,8 @@ def change_reviewed_status(self, project_key, repository_slug, pull_request_id,
:param user_slug:
:return:
"""
url = "rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug}".format(
projectKey=project_key, repositorySlug=repository_slug, pullRequestId=pull_request_id, userSlug=user_slug,
url = 'rest/api/1.0/projects/{projectKey}/repos/{repo}/pull-requests/{pull_request}/participants/{userSlug}'.format(
projectKey=project_key, repo=repository_slug, pull_request=pull_request_id, userSlug=user_slug,
)
approved = True if status == "APPROVED" else False
data = {
Expand Down
9 changes: 5 additions & 4 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,10 +895,11 @@ def get_group_members(self, group_name='confluence-users', start=0, limit=1000,
:param expand: OPTIONAL: A comma separated list of properties to expand on the content. status
:return:
"""
url = 'rest/api/group/{group_name}/member?limit={limit}&start={start}&expand={expand}'.format(group_name=group_name,
limit=limit,
start=start,
expand=expand)
url = 'rest/api/group/{group_name}/member?limit={limit}&start={start}&expand={expand}'.format(
group_name=group_name,
limit=limit,
start=start,
expand=expand)
return (self.get(url) or {}).get('results')

def get_space(self, space_key, expand='description.plain,homepage'):
Expand Down
33 changes: 18 additions & 15 deletions atlassian/jira.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding=utf-8
import logging

import re
from requests.exceptions import HTTPError
from .rest_client import AtlassianRestAPI

Expand Down Expand Up @@ -306,34 +306,33 @@ def user_find_by_user_string(self, username, start=0, limit=50, include_inactive
}
return self.get(url, params=params)

def is_user_in_application(self, username, applicationKey):
def is_user_in_application(self, username, application_key):
"""
Utility function to test whether a user has an application role
:param username: The username of the user to test.
:param applicationKey: The application key of the application
:param application_key: The application key of the application
:return: True if the user has the application, else False
"""
user = self.user(username, 'applicationRoles') # Get applications roles of the user
if 'self' in user:
for applicationRole in user.get('applicationRoles').get('items'):
if applicationRole.get('key') == applicationKey:
for application_role in user.get('applicationRoles').get('items'):
if application_role.get('key') == application_key:
return True

return False

def add_user_to_application(self, username, applicationKey):
def add_user_to_application(self, username, application_key):
"""
Add a user to an application
:param username: The username of the user to add.
:param applicationKey: The application key of the application
:param application_key: The application key of the application
:return: True if the user was added to the application, else False
:see: https://docs.atlassian.com/software/jira/docs/api/REST/7.5.3/#api/2/user-addUserToApplication
"""
params = {
'username': username,
'applicationKey': applicationKey
'applicationKey': application_key
}
return self.post('rest/api/2/user/application', params=params) == None
return self.post('rest/api/2/user/application', params=params) is None

# Application roles
def get_all_application_roles(self):
Expand Down Expand Up @@ -577,8 +576,13 @@ def bulk_issue(self, issue_list, fields='*all'):
:param list issue_list:
:return:
"""
jira_issue_regex = re.compile('[A-Z]{1,10}-\d+')
missing_issues = list()
jql = 'key in ({})'.format(', '.join(['"{}"'.format(key) for key in issue_list]))
matched_issue_keys = list()
for key in issue_list:
if re.match(jira_issue_regex, key):
matched_issue_keys.append(key)
jql = 'key in ({})'.format(', '.join(matched_issue_keys))
query_result = self.jql(jql, fields=fields)
if 'errorMessages' in query_result.keys():
for message in query_result['errorMessages']:
Expand Down Expand Up @@ -2071,10 +2075,9 @@ def tempo_teams_add_member(self, team_id, member_key):
:return:
"""
data = {"member": {"key": str(member_key), "type": "USER"},
"membership": {
"availability": "100",
"role": {"id": 1}
}}
"membership": {"availability": "100",
"role": {"id": 1}}
}
return self.tempo_teams_add_member_raw(team_id, member_data=data)

def tempo_teams_add_membership(self, team_id, member_id):
Expand Down
2 changes: 1 addition & 1 deletion atlassian/jira8.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@


class Jira8(Jira):
# methods migrated into main module
# methods migrated into main module