本文整理汇总了Python中jira.JIRA.create_project方法的典型用法代码示例。如果您正苦于以下问题:Python JIRA.create_project方法的具体用法?Python JIRA.create_project怎么用?Python JIRA.create_project使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jira.JIRA
的用法示例。
在下文中一共展示了JIRA.create_project方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_project
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_project [as 别名]
def create_project(params):
api_server = params['api_url']
api_username = params['api_username']
api_password = params['api_password']
auth = (api_username, api_password)
jira = JIRA( {'server': api_server}, basic_auth=auth)
project_key = params['project_key']
project_name = params['project_name']
assignee = params['assignee']
# create project and view
if not jira.create_project(project_key, name=project_name, assignee=assignee):
return None
proj = jira.project(project_key)
board = jira.create_board("{0} View".format(project_name), project_key, preset='scrum')
issue = jira.create_issue(
project=project_key,
summary="Sample Issue for {0}".format(project_name),
description="This is just sample",
issuetype={"name":"Task"}
)
return proj
示例2: JiraTestManager
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_project [as 别名]
#.........这里部分代码省略.........
'access_token': 'ZVDgYDyIQqJY8IFlQ446jZaURIz5ECiB',
'access_token_secret':
'5WbLBybPDg1lqqyFjyXSCsCtAWTwz1eD',
'consumer_key': CONSUMER_KEY,
'key_cert': KEY_CERT_DATA})
else:
if self.CI_JIRA_ADMIN:
self.jira_normal = JIRA(self.CI_JIRA_URL,
basic_auth=(self.CI_JIRA_USER,
self.CI_JIRA_USER_PASSWORD),
validate=True, logging=False, max_retries=self.max_retries)
else:
self.jira_normal = JIRA(self.CI_JIRA_URL,
validate=True, logging=False, max_retries=self.max_retries)
# now we need some data to start with for the tests
# jira project key is max 10 chars, no letter.
# [0] always "Z"
# [1-6] username running the tests (hope we will not collide)
# [7-8] python version A=0, B=1,..
# [9] A,B -- we may need more than one project
prefix = 'Z' + (re.sub("[^A-Z]", "",
getpass.getuser().upper()))[0:6] + \
chr(ord('A') + sys.version_info[0]) + \
chr(ord('A') + sys.version_info[1])
self.project_a = prefix + 'A' # old XSS
self.project_a_name = "Test user=%s python=%s.%s A" \
% (getpass.getuser(), sys.version_info[0],
sys.version_info[1])
self.project_b_name = "Test user=%s python=%s.%s B" \
% (getpass.getuser(), sys.version_info[0],
sys.version_info[1])
self.project_b = prefix + 'B' # old BULK
try:
self.jira_admin.project(self.project_a)
except Exception as e:
logging.warning(e)
pass
else:
self.jira_admin.delete_project(self.project_a)
try:
self.jira_admin.project(self.project_b)
except Exception as e:
logging.warning(e)
pass
else:
self.jira_admin.delete_project(self.project_b)
self.jira_admin.create_project(self.project_a,
self.project_a_name)
self.project_a_id = self.jira_admin.project(self.project_a).id
self.jira_admin.create_project(self.project_b,
self.project_b_name)
self.project_b_issue1_obj = self.jira_admin.create_issue(project=self.project_b,
summary='issue 1 from %s'
% self.project_b,
issuetype=self.CI_JIRA_ISSUE)
self.project_b_issue1 = self.project_b_issue1_obj.key
self.project_b_issue2_obj = self.jira_admin.create_issue(project=self.project_b,
summary='issue 2 from %s'
% self.project_b,
issuetype={'name': self.CI_JIRA_ISSUE})
self.project_b_issue2 = self.project_b_issue2_obj.key
self.project_b_issue3_obj = self.jira_admin.create_issue(project=self.project_b,
summary='issue 3 from %s'
% self.project_b,
issuetype={'name': self.CI_JIRA_ISSUE})
self.project_b_issue3 = self.project_b_issue3_obj.key
except Exception as e:
# exc_type, exc_value, exc_traceback = sys.exc_info()
formatted_lines = traceback.format_exc().splitlines()
msg = "Basic test setup failed: %s\n\t%s" % (
e, "\n\t".join(formatted_lines))
logging.fatal(msg)
self.initialized = 1
pytest.exit("FATAL")
self.initialized = 1
else:
# already exist but we need to be sure it was initialized
counter = 0
while not self.initialized:
sleep(1)
counter += 1
if counter > 60:
logging.fatal("Something is clearly not right with " +
"initialization, killing the tests to prevent a " +
"deadlock.")
sys.exit(3)