當前位置: 首頁>>代碼示例>>Python>>正文


Python Jenkins.create方法代碼示例

本文整理匯總了Python中autojenkins.Jenkins.create方法的典型用法代碼示例。如果您正苦於以下問題:Python Jenkins.create方法的具體用法?Python Jenkins.create怎麽用?Python Jenkins.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在autojenkins.Jenkins的用法示例。


在下文中一共展示了Jenkins.create方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TestJenkins

# 需要導入模塊: from autojenkins import Jenkins [as 別名]
# 或者: from autojenkins.Jenkins import create [as 別名]

#.........這裏部分代碼省略.........

    def checks_last_build_info(self, response):
        self.check_results(
            response,
            [(('timestamp',), 1330941036216L),
             (('number',), 1783),
             (('result',), 'FAILURE'),
             (('changeSet', 'kind'), 'svn'),
            ])

    def checks_last_build_report(self, response):
        self.check_results(
            response,
            [(('duration',), 692.3089),
             (('failCount',), 1),
             (('suites', 0, 'name'), 'org.apache.solr.BasicFunctionalityTest'),
            ])

    def checks_last_success(self, response):
        self.check_results(
            response,
            [(('result',), 'SUCCESS'),
             (('building',), False),
             (('artifacts', 0, 'displayPath'),
              'apache-solr-4.0-2012-02-29_09-07-30-src.tgz'),
            ])

    def checks_get_config_xml(self, response):
        self.assertTrue(response.startswith('<?xml'))
        self.assertTrue(response.endswith('</project>'))

    # TODO: test job creation, and set_config_xml

    def test_create(self, requests):
        requests.post.return_value = mock_response()
        config_xml = path.join(fixture_path, 'create_copy.txt')
        self.jenkins.create('job', config_xml, value='2')
        CFG = "<value>2</value><disabled>true</disabled>"
        requests.post.assert_called_once_with(
            'http://jenkins/createItem',
            auth=None,
            headers={'Content-Type': 'application/xml'},
            params={'name': 'job'},
            data=CFG,
            verify=True)

    def test_create_copy(self, requests):
        requests.get.return_value = mock_response('create_copy.txt')
        requests.post.return_value = mock_response()
        self.jenkins.create_copy('job', 'template', value='2')
        CFG = "<value>2</value><disabled>false</disabled>"
        requests.post.assert_called_once_with(
            'http://jenkins/createItem',
            auth=None,
            headers={'Content-Type': 'application/xml'},
            params={'name': 'job'},
            data=CFG,
            verify=True)

    def test_transfer(self, requests):
        requests.get.return_value = mock_response('transfer.txt')
        requests.post.return_value = mock_response()
        self.jenkins.transfer('job', 'http://jenkins2')
        CFG = load_fixture('transfer.txt')
        requests.post.assert_called_once_with(
            'http://jenkins2/createItem',
開發者ID:Mondego,項目名稱:pyreco,代碼行數:70,代碼來源:allPythonContent.py


注:本文中的autojenkins.Jenkins.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。