当前位置: 首页>>代码示例>>Python>>正文


Python Jenkins.easy_connect方法代码示例

本文整理汇总了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
开发者ID:,项目名称:,代码行数:32,代码来源:

示例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)
开发者ID:,项目名称:,代码行数:10,代码来源:

示例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)
开发者ID:,项目名称:,代码行数:10,代码来源:

示例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)
开发者ID:,项目名称:,代码行数:11,代码来源:

示例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)
开发者ID:,项目名称:,代码行数:11,代码来源:

示例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)
开发者ID:,项目名称:,代码行数:15,代码来源:

示例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)
开发者ID:,项目名称:,代码行数:22,代码来源:

示例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)        
开发者ID:,项目名称:,代码行数:8,代码来源:


注:本文中的pyjen.jenkins.Jenkins.easy_connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。