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


Python TreeherderResultSetCollection.get_resultset方法代码示例

本文整理汇总了Python中treeherder.client.TreeherderResultSetCollection.get_resultset方法的典型用法代码示例。如果您正苦于以下问题:Python TreeherderResultSetCollection.get_resultset方法的具体用法?Python TreeherderResultSetCollection.get_resultset怎么用?Python TreeherderResultSetCollection.get_resultset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在treeherder.client.TreeherderResultSetCollection的用法示例。


在下文中一共展示了TreeherderResultSetCollection.get_resultset方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_send_result_collection

# 需要导入模块: from treeherder.client import TreeherderResultSetCollection [as 别名]
# 或者: from treeherder.client.TreeherderResultSetCollection import get_resultset [as 别名]
    def test_send_result_collection(self, mock_post):
        """Can add a treeherder collections to a TreeherderRequest."""
        mock_post.return_value = self._expected_response_return_object()

        trc = TreeherderResultSetCollection()

        for resultset in self.resultset_data:
            trc.add(trc.get_resultset(resultset))

        client = TreeherderClient(
            protocol='http',
            host='host',
            client_id='client-abc',
            secret='secret123',
            )

        client.post_collection('project', trc)

        path, resp = mock_post.call_args

        self.assertEqual(mock_post.call_count, 1)
        self.assertEqual(
            trc.get_collection_data(),
            resp['json']
            )
开发者ID:EricRahm,项目名称:treeherder,代码行数:27,代码来源:test_treeherder_client.py

示例2: test_resultset_create

# 需要导入模块: from treeherder.client import TreeherderResultSetCollection [as 别名]
# 或者: from treeherder.client.TreeherderResultSetCollection import get_resultset [as 别名]
def test_resultset_create(jm, test_repository, sample_resultset,
                          mock_post_json):
    """
    test posting data to the resultset endpoint via webtest.
    extected result are:
    - return code 200
    - return message successful
    - 1 resultset stored in the jobs schema
    """

    assert Push.objects.count() == 0

    # store the first two, so we submit all, but should properly not re-
    # add the others.
    jm.store_result_set_data(sample_resultset[:2])
    assert Push.objects.count() == 2

    trsc = TreeherderResultSetCollection()
    exp_revision_hashes = set()
    for rs in sample_resultset:
        rs.update({'author': 'John Doe'})
        result_set = trsc.get_resultset(rs)
        trsc.add(result_set)
        exp_revision_hashes.add(rs["revision"])

    test_utils.post_collection(jm.project, trsc)

    assert Push.objects.count() == len(sample_resultset)
    assert set(Push.objects.values_list('revision', flat=True)) == set(
        [rs['revision'] for rs in sample_resultset])
开发者ID:askeing,项目名称:treeherder,代码行数:32,代码来源:test_resultset_api.py

示例3: test_resultset_create

# 需要导入模块: from treeherder.client import TreeherderResultSetCollection [as 别名]
# 或者: from treeherder.client.TreeherderResultSetCollection import get_resultset [as 别名]
def test_resultset_create(sample_resultset, jm, initial_data):
    """
    test posting data to the resultset endpoint via webtest.
    extected result are:
    - return code 200
    - return message successful
    - 1 resultset stored in the jobs schema
    """

    trsc = TreeherderResultSetCollection()

    for rs in sample_resultset:
        rs = trsc.get_resultset(rs)
        trsc.add(rs)

    resp = test_utils.post_collection(jm.project, trsc)

    assert resp.status_int == 200
    assert resp.json['message'] == 'well-formed JSON stored'

    stored_objs = jm.get_dhub().execute(
        proc="jobs_test.selects.resultset_by_rev_hash",
        placeholders=[sample_resultset[0]['revision_hash']]
    )

    assert len(stored_objs) == 1
    assert stored_objs[0]['revision_hash'] == sample_resultset[0]['revision_hash']

    jm.disconnect()
开发者ID:bwinton,项目名称:treeherder,代码行数:31,代码来源:test_resultset_api.py

示例4: test_resultset_create

# 需要导入模块: from treeherder.client import TreeherderResultSetCollection [as 别名]
# 或者: from treeherder.client.TreeherderResultSetCollection import get_resultset [as 别名]
def test_resultset_create(sample_resultset, jm, initial_data, mock_post_json):
    """
    test posting data to the resultset endpoint via webtest.
    extected result are:
    - return code 200
    - return message successful
    - 1 resultset stored in the jobs schema
    """

    trsc = TreeherderResultSetCollection()

    for rs in sample_resultset:
        rs.update({'author': 'John Doe'})
        result_set = trsc.get_resultset(rs)
        trsc.add(result_set)

    test_utils.post_collection(jm.project, trsc)

    stored_objs = jm.get_dhub().execute(
        proc="jobs_test.selects.resultset_by_rev_hash",
        placeholders=[sample_resultset[0]['revision_hash']]
    )

    assert len(stored_objs) == 1
    assert stored_objs[0]['revision_hash'] == sample_resultset[0]['revision_hash']

    jm.disconnect()
开发者ID:EricRahm,项目名称:treeherder,代码行数:29,代码来源:test_resultset_api.py

示例5: test_resultset_create

# 需要导入模块: from treeherder.client import TreeherderResultSetCollection [as 别名]
# 或者: from treeherder.client.TreeherderResultSetCollection import get_resultset [as 别名]
def test_resultset_create(jm, test_repository, sample_resultset,
                          mock_post_json):
    """
    test posting data to the resultset endpoint via webtest.
    extected result are:
    - return code 200
    - return message successful
    - 1 resultset stored in the jobs schema
    """

    # store the first two, so we submit all, but should properly not re-
    # add the others.

    jm.store_result_set_data(sample_resultset[:2])

    trsc = TreeherderResultSetCollection()
    exp_revision_hashes = set()
    for rs in sample_resultset:
        rs.update({'author': 'John Doe'})
        result_set = trsc.get_resultset(rs)
        trsc.add(result_set)
        exp_revision_hashes.add(rs["revision"])

    resp = test_utils.post_collection(jm.project, trsc)

    act_revision_hashes = {x["long_revision"] for x in resp.json["resultsets"]}
    assert exp_revision_hashes == act_revision_hashes

    stored_objs = jm.get_dhub().execute(
        proc="jobs_test.selects.resultset_by_long_revision",
        placeholders=[sample_resultset[0]['revision']]
    )

    assert len(stored_objs) == 1
    assert stored_objs[0]['long_revision'] == sample_resultset[0]['revision']
开发者ID:AnthonyMeaux,项目名称:treeherder,代码行数:37,代码来源:test_resultset_api.py

示例6: test_resultset_with_bad_key

# 需要导入模块: from treeherder.client import TreeherderResultSetCollection [as 别名]
# 或者: from treeherder.client.TreeherderResultSetCollection import get_resultset [as 别名]
def test_resultset_with_bad_key(sample_resultset, jm, initial_data):

    trsc = TreeherderResultSetCollection()
    for rs in sample_resultset:
        rs = trsc.get_resultset(rs)
        trsc.add(rs)

    resp = test_utils.post_collection(
        jm.project, trsc, status=403, consumer_key="horrible-key"
    )

    assert resp.status_int == 403
    assert resp.json['detail'] == 'oauth_consumer_key does not match credentials for project {0}'.format(jm.project)
开发者ID:mjzffr,项目名称:treeherder,代码行数:15,代码来源:test_resultset_api.py

示例7: test_resultset_with_bad_secret

# 需要导入模块: from treeherder.client import TreeherderResultSetCollection [as 别名]
# 或者: from treeherder.client.TreeherderResultSetCollection import get_resultset [as 别名]
def test_resultset_with_bad_secret(sample_resultset, jm, initial_data):

    trsc = TreeherderResultSetCollection()
    for rs in sample_resultset:
        rs = trsc.get_resultset(rs)
        trsc.add(rs)

    resp = test_utils.post_collection(
        jm.project, trsc, status=403, consumer_secret="horrible secret"
    )

    assert resp.status_int == 403
    assert resp.json['detail'] == "Client authentication failed for project {0}".format(jm.project)
开发者ID:mjzffr,项目名称:treeherder,代码行数:15,代码来源:test_resultset_api.py

示例8: test_send_result_collection

# 需要导入模块: from treeherder.client import TreeherderResultSetCollection [as 别名]
# 或者: from treeherder.client.TreeherderResultSetCollection import get_resultset [as 别名]
    def test_send_result_collection(self, mock_post):
        """Can add a treeherder collections to a TreeherderRequest."""
        mock_post.return_value = self._expected_response_return_object()

        trc = TreeherderResultSetCollection()

        for resultset in self.resultset_data:

            trc.add(trc.get_resultset(resultset))

        client = TreeherderClient(protocol="http", host="host")

        auth = TreeherderAuth("key", "secret", "project")
        client.post_collection("project", trc, auth=auth)

        path, resp = mock_post.call_args

        self.assertEqual(mock_post.call_count, 1)
        self.assertEqual(trc.get_collection_data(), resp["json"])
开发者ID:EdgarChen,项目名称:treeherder,代码行数:21,代码来源:test_treeherder_client.py

示例9: test_send_result_collection

# 需要导入模块: from treeherder.client import TreeherderResultSetCollection [as 别名]
# 或者: from treeherder.client.TreeherderResultSetCollection import get_resultset [as 别名]
    def test_send_result_collection(self):
        """Can add a treeherder collections to a TreeherderRequest."""
        trc = TreeherderResultSetCollection()

        for resultset in self.resultset_data:
            trc.add(trc.get_resultset(resultset))

        client = TreeherderClient(protocol="http", host="host", client_id="client-abc", secret="secret123")

        def request_callback(request):
            # Check that the expected content was POSTed.
            posted_json = json.loads(request.body)
            self.assertEqual(posted_json, trc.get_collection_data())
            return (200, {}, '{"message": "well-formed JSON stored", "resultsets": [123, 456]}')

        url = client._get_project_uri("project", trc.endpoint_base)
        responses.add_callback(
            responses.POST, url, match_querystring=True, callback=request_callback, content_type="application/json"
        )

        client.post_collection("project", trc)
开发者ID:samh12,项目名称:treeherder,代码行数:23,代码来源:test_treeherder_client.py

示例10: test_send_result_collection

# 需要导入模块: from treeherder.client import TreeherderResultSetCollection [as 别名]
# 或者: from treeherder.client.TreeherderResultSetCollection import get_resultset [as 别名]
    def test_send_result_collection(self, mock_send):
        """Can add a treeherder collections to a TreeherderRequest."""

        trc = TreeherderResultSetCollection()

        for resultset in self.resultset_data:

            trc.add(trc.get_resultset(resultset))

        req = TreeherderRequest(
            protocol='http',
            host='host',
            project='project',
            oauth_key='key',
            oauth_secret='secret',
            )

        req.post(trc)

        self.assertEqual(mock_send.call_count, 1)
        self.assertEqual(
            trc.to_json(),
            mock_send.call_args_list[0][1]['data']
            )
开发者ID:djmitche,项目名称:treeherder,代码行数:26,代码来源:test_treeherder_client.py


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