本文整理汇总了Python中jenkinsapi.job.Job.has_params方法的典型用法代码示例。如果您正苦于以下问题:Python Job.has_params方法的具体用法?Python Job.has_params怎么用?Python Job.has_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jenkinsapi.job.Job
的用法示例。
在下文中一共展示了Job.has_params方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_params_list
# 需要导入模块: from jenkinsapi.job import Job [as 别名]
# 或者: from jenkinsapi.job.Job import has_params [as 别名]
def test_get_params_list(self, get_data):
url = 'http://halob:8080/job/foo/%s' % config.JENKINS_API
get_data.return_value = TestJob.URL_DATA[url].copy()
j = Job('http://halob:8080/job/foo/', 'foo', self.J)
self.assertTrue(j.has_params())
params = j.get_params_list()
self.assertIsInstance(params, list)
self.assertEquals(len(params), 2)
self.assertEquals(params, ['param1', 'param2'])
示例2: TestJob
# 需要导入模块: from jenkinsapi.job import Job [as 别名]
# 或者: from jenkinsapi.job.Job import has_params [as 别名]
class TestJob(unittest.TestCase):
JOB_DATA = {'actions': [None, {}],
'buildable': True,
'builds': [{'number': 106,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/106/'},
{'number': 105,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/105/'},
{'number': 104,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/104/'},
{'number': 103,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/103/'},
{'number': 102,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/102/'},
{'number': 101,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/101/'},
{'number': 100,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/100/'},
{'number': 99,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/99/'},
{'number': 98,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/98/'},
{'number': 97,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/97/'}],
'color': 'red',
'concurrentBuild': False,
'description': '',
'displayName': 'ecd-webgoat',
'displayNameOrNull': None,
'downstreamProjects': [],
'firstBuild': {'number': 97,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/97/'},
'healthReport': [{'description': 'Build stability: 1 out of the last 5 builds failed.',
'iconUrl': 'health-60to79.png',
'score': 80}],
'inQueue': False,
'keepDependencies': False,
'lastBuild': {'number': 106,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/106/'},
'lastCompletedBuild': {'number': 106,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/106/'},
'lastFailedBuild': {'number': 106,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/106/'},
'lastStableBuild': {'number': 105,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/105/'},
'lastSuccessfulBuild': {'number': 105,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/105/'},
'lastUnstableBuild': None,
'lastUnsuccessfulBuild': {'number': 106,
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/106/'},
'modules': [{'color': 'blue',
'displayName': 'webgoat',
'name': 'com.googlecode:webgoat',
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/com.googlecode$webgoat/'}],
'name': 'ecd-webgoat',
'nextBuildNumber': 107,
'property': [{}],
'queueItem': None,
'scm': {},
'upstreamProjects': [],
'url': 'http://dlsysadm-ap72:18080/jenkins/job/ecd-webgoat/'
}
URL_DATA = {'http://halob:8080/job/foo/%s' % config.JENKINS_API: JOB_DATA}
def fakeGetData(self, url, **args):
try:
return TestJob.URL_DATA[url]
except KeyError:
raise Exception("Missing data for %s" % url)
# def fake_add_missing_builds(self, data):
# return data
@mock.patch.object(JenkinsBase, 'get_data', fakeGetData)
#@mock.patch.object(Job, '_add_missing_builds', fake_add_missing_builds)
def setUp(self):
self.J = mock.MagicMock() # Jenkins object
self.j = Job('http://halob:8080/job/foo/', 'foo', self.J)
@mock.patch.object(JenkinsBase, 'get_data', fakeGetData)
def test_get_last_good_buildnumber(self):
ret = self.j.get_last_good_buildnumber()
self.assertTrue(ret, 3)
@mock.patch.object(JenkinsBase, 'get_data', fakeGetData)
def test_has_params(self):
self.assertFalse(self.j.has_params())