The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to write unit tests for code written using python jira api?

Surya
October 20, 2020

I'm looking to write unit tests for the following code. Please help me figure out the solution.

def jiraConnect(username, password):

try:
logger.info("Connecting to Jira")
jira = JIRA(basic_auth = (username, password), options = {'server':'<ip-address/url>'})
logger.info("Connected to Jira")
return jira
except JIRAError as e:
return e.status_code, e.text

def getIssues(jql, field_list):
try:
size = 100
initial = 0
allIssues = []
while True:
start = initial*size
issues = jc.search_issues(f"{jql}", start, size, fields = field_list)
if(len(issues)==0:
break
initial += 1
for issue in issues:
allIssues.append(issue)
return allIssues
except JIRAError as e:
return e.status_code, e.text

 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Gonchik Tsymzhitov
Community Champion
January 28, 2021