本文整理汇总了Python中jira.JIRA.project_components方法的典型用法代码示例。如果您正苦于以下问题:Python JIRA.project_components方法的具体用法?Python JIRA.project_components怎么用?Python JIRA.project_components使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jira.JIRA
的用法示例。
在下文中一共展示了JIRA.project_components方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestComponents
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import project_components [as 别名]
class TestComponents(unittest.TestCase):
def setUp(self):
self.jira = JIRA(options=dict(server=TEST_URL, verify=False), basic_auth=(TEST_USERNAME, TEST_PASSWORD))
self.purge_test_components()
def tearDown(self):
self.purge_test_components()
def get_component(self, name):
components = [_ for _ in self.jira.project_components('KB') if _.name == 'test-1']
return components[0] if len(components) == 1 else None
def purge_test_components(self):
for _ in self.jira.project_components('KB'):
if _.name.startswith('test-'):
_.delete()
def test_create_component(self):
result = CliRunner().invoke(topcli, ['component', 'create', 'KB', 'test-1', '-d', 'Some description'])
self.assertEqual(result.exit_code, 0)
def test_delete_component(self):
result = CliRunner().invoke(topcli, ['component', 'create', 'KB', 'test-1'])
self.assertEqual(result.exit_code, 0)
self.assertIsNotNone(self.get_component('test-1'))
result = CliRunner().invoke(topcli, ['component', 'delete', 'KB', 'test-1'])
self.assertEqual(result.exit_code, 0)
self.assertIsNone(self.get_component('test-1'))
def test_update_component(self):
result = CliRunner().invoke(topcli, ['component', 'create', 'KB', 'test-1', '-d', 'before'])
before = self.get_component('test-1')
self.assertEqual(before.description, 'before')
result = CliRunner().invoke(topcli, ['component', 'update', 'KB', 'test-1', '-d', 'after'])
self.assertEqual(result.exit_code, 0)
after = self.get_component('test-1')
self.assertEqual(after.description, 'after')
def test_search_component(self):
result = CliRunner().invoke(topcli, ['component', 'create', 'KB', 'test-1', '-d', 'Some description'])
result = CliRunner().invoke(topcli, ['component', 'search', 'KB'])
self.assertEqual(result.exit_code, 0)
self.assertIn('test-1', result.output)
self.assertIn('Some description', result.output)
示例2: prettyXML
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import project_components [as 别名]
failureDetails = failureDetails + '{code:title=' + testurl + '' + className_re + '/' + name_re + '}\n'
failureDetails = failureDetails + prettyXML(s)
failureDetails = failureDetails + '\n{code}\n\n'
#print failureDetails
rootJBIDE_dict = {
'project' : { 'key': 'JBIDE' },
'summary' : str(len(testcaselist)) + ' Test Failure(s) in JBIDE ' + jbide_affectedversion + ' for ' + component + ' component',
'description' : failureSummary + failureDetails,
'issuetype' : { 'name' : 'Task' },
'priority' : { 'name' :'Critical'},
'versions' : [{ "name" : jbide_affectedversion }],
'components' : [{ "name" : component }],
'labels' : [ "testfailure" ]
}
jira = JIRA(options={'server':jiraserver}, basic_auth=(options.usernameJIRA, options.passwordJIRA))
CLJBIDE = jira.project_components(jira.project('JBIDE')) # full list of components in JBIDE
rootJBIDE = jira.create_issue(fields=rootJBIDE_dict)
componentLead = queryComponentLead(CLJBIDE, component, 0)
try:
jira.assign_issue(rootJBIDE, componentLead)
except:
print "[WARNING] Unexpected error! User {0} tried to assign {1} to {2}: {3}".format(options.usernameJIRA, rootJBIDE, componentLead, sys.exc_info()[0])
accept = raw_input("\nAccept new JIRA " + jiraserver + '/browse/' + rootJBIDE.key + " => " + componentLead + " ? [Y/n] ")
if accept.capitalize() in ["N"] :
rootJBIDE.delete()
# see JIRA_components listing in components.py
# Sample usage: see createTestFailureJIRA.py.examples.txt
示例3: JIRA
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import project_components [as 别名]
password=creds[1]
server=creds[2]
##Get arguments.
parser = argparse.ArgumentParser(description='You have to specify 2 arguments that describes source project and destionation peroject.')
parser.add_argument('--source', action='store', help='Source Project')
parser.add_argument('--dest', action='store', help='Destination Project')
args = parser.parse_args()
if not args.source or not args.dest:
parser.print_help()
sys.exit()
##Acess Jira and get info.
jira = JIRA(server=server,basic_auth=(username,password))
projSrc = jira.project_components(args.source)
projDst = jira.project_components(args.dest)
###Component match
cMatch=re.compile('^BFB.*')
###Get 'raw' lists (Jira classes are not so handy)
listSrc=[]
listDst=[]
for i in projSrc:
if cMatch.match(str(i)):
listSrc.append(str(i))
for i in projDst:
if cMatch.match(str(i)):