本文整理汇总了Python中pyjen.jenkins.Jenkins.easy_connect方法的典型用法代码示例。如果您正苦于以下问题:Python Jenkins.easy_connect方法的具体用法?Python Jenkins.easy_connect怎么用?Python Jenkins.easy_connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjen.jenkins.Jenkins
的用法示例。
在下文中一共展示了Jenkins.easy_connect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import easy_connect [as 别名]
def find_view(jenkins_url, credentials, view_name):
"""Locates a view with a given name recursively across a Jenkins instance
This helper function has knowledge of view plugins that support sub-views
and thus recursively searches these sub-views for the requested view
WARNING: This function can be quite slow when executed against a large Jenkins
build farm with a large number of views and subviews.
:param str jenkins_url: URL of the root Jenkins master
:param tuple credentials: 2-tuple containing the user-name and password to authenticate with
:param str view_name: name of the view to locate
:returns: Reference to the view with the provided name, or None if the view doesn't exist
:rtype: :class:`~.view.View`
"""
from pyjen.plugins.nestedview import NestedView
jen = Jenkins.easy_connect(jenkins_url, credentials)
parent_view = jen.find_view(view_name)
if parent_view is not None:
return parent_view
for cur_view in jen.views:
if cur_view.type == NestedView.type:
sub_view = cur_view.find_view(view_name)
if sub_view is not None:
return sub_view
return None
示例2: test_find_job
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import easy_connect [as 别名]
def test_find_job(self):
expected_job_name = "JobNumber1"
j = Jenkins.easy_connect(self._jenkins_url, None)
job = j.find_job(expected_job_name)
self.assertEqual(expected_job_name, job.name)
示例3: test_find_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import easy_connect [as 别名]
def test_find_view(self):
expected_view_name = "ViewNumber1"
j = Jenkins.easy_connect(self._jenkins_url, None)
v = j.find_view(expected_view_name)
self.assertEqual(expected_view_name, v.name)
示例4: test_shutdown
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import easy_connect [as 别名]
def test_shutdown(self):
j = Jenkins.easy_connect(self._jenkins_url, None)
self.assertFalse(j.is_shutting_down)
j.prepare_shutdown()
self.assertTrue(j.is_shutting_down)
j.cancel_shutdown()
self.assertFalse(j.is_shutting_down)
示例5: test_create_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import easy_connect [as 别名]
def test_create_view(self):
new_view_name = "test_create_view"
j = Jenkins.easy_connect(self._jenkins_url, None)
j.create_view(new_view_name, "hudson.model.ListView")
v = j.find_view(new_view_name)
self.assertTrue(v is not None)
self.assertEqual(v.name, new_view_name)
示例6: test_last_build
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import easy_connect [as 别名]
def test_last_build(self):
job_url = self._jenkins_url + "/job/JobNumber1"
j = Jenkins.easy_connect(self._jenkins_url, None)
job = j.get_job(job_url)
#sanity check: make sure our generated URL works correctly
self.assertEqual("JobNumber1", job.name)
build = job.last_build
self.assertEqual(2, build.number)
示例7: test_get_builds
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import easy_connect [as 别名]
def test_get_builds(self):
job_url = self._jenkins_url + "/job/JobNumber1"
j = Jenkins.easy_connect(self._jenkins_url, None)
job = j.get_job(job_url)
#sanity check: make sure our generated URL works correctly
self.assertEqual("JobNumber1", job.name)
builds = job.recent_builds
self.assertEqual(2, len(builds))
expected_numbers = [1, 2]
expected_results = ["SUCCESS", "FAILURE"]
for build in builds:
self.assertTrue(build.number in expected_numbers)
self.assertTrue(build.result in expected_results)
expected_numbers.remove(build.number)
expected_results.remove(build.result)
示例8: test_default_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import easy_connect [as 别名]
def test_default_view(self):
j = Jenkins.easy_connect(self._jenkins_url, None)
v = j.default_view
self.assertIsNotNone(v)
self.assertEqual("All", v.name)