Answer the question
In order to leave comments, you need to log in
How to write mock for Jira connector?
There is a piece of code that returns a jira object with which the rest of the functions work in the future. I can’t write tests for other functions, because I can’t figure out how, in principle, to lock an object of this kind in pytest?
#!/usr/bin/env python3.7
import os
from jira import JIRA
def jira_connector(url=os.environ["JIRA_URL"], j_user=os.environ["JIRA_USER"], j_pass=os.environ["JIRA_PASS"]):
jira_options = {'server': url}
jira = JIRA(options=jira_options, basic_auth=(
j_user, j_pass), logging=True, timeout=10)
return jira
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question