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


Python TreeherderResultSetCollection.add方法代碼示例

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


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

示例1: test_resultset_create

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [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

示例2: test_send_result_collection

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [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

示例3: test_resultset_sample_data

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [as 別名]
    def test_resultset_sample_data(self):
        """Test all add methods for building result sets"""

        trsc = TreeherderResultSetCollection()

        for resultset in self.resultset_data:

            trs = TreeherderResultSet()

            trs.add_push_timestamp(resultset['push_timestamp'])
            trs.add_revision_hash(resultset['revision_hash'])
            trs.add_author(resultset['author'])
            trs.add_type('push')

            for revision in resultset['revisions']:

                tr = TreeherderRevision()

                tr.add_revision(revision['revision'])
                tr.add_author(revision['author'])
                tr.add_comment(revision['comment'])
                tr.add_repository(revision['repository'])

                trs.add_revision(tr)

            self.compare_structs(trs.data, resultset)

            trsc.add(trs)

            # confirm we get the same thing if we initialize from
            # a resultset dict
            trs_struct = TreeherderResultSet(resultset)

            self.compare_structs(trs_struct.data, resultset)
開發者ID:EricRahm,項目名稱:treeherder,代碼行數:36,代碼來源:test_treeherder_client.py

示例4: test_resultset_create

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [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

示例5: test_resultset_create

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [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

示例6: test_resultset_create

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [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

示例7: test_resultset_collection

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [as 別名]
    def test_resultset_collection(self):
        """Confirm the collection matches the sample data"""
        trc = TreeherderResultSetCollection()

        for resultset in self.resultset_data:
            trs = TreeherderResultSet(resultset)
            trc.add(trs)

        self.assertTrue(len(self.resultset_data) == len(trc.data))
開發者ID:EricRahm,項目名稱:treeherder,代碼行數:11,代碼來源:test_treeherder_client.py

示例8: test_resultset_with_bad_key

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [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

示例9: test_resultset_with_bad_secret

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [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

示例10: test_send_result_collection

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [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

示例11: test_send_result_collection

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [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

示例12: test_resultset_sample_data

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [as 別名]
    def test_resultset_sample_data(self):
        """Test all add methods for building result sets"""

        trsc = TreeherderResultSetCollection()

        for resultset in self.resultset_data:

            trs = TreeherderResultSet()

            trs.add_push_timestamp(resultset["push_timestamp"])
            trs.add_revision(resultset["revision"])
            trs.add_author(resultset["author"])
            trs.add_type("push")

            revisions = []
            for revision in resultset["revisions"]:

                tr = TreeherderRevision()

                tr.add_revision(revision["revision"])
                tr.add_author(revision["author"])
                tr.add_comment(revision["comment"])
                tr.add_repository(revision["repository"])

                revisions.append(tr)

            trs.add_revisions(revisions)

            self.compare_structs(trs.data, resultset)

            trsc.add(trs)

            # confirm we get the same thing if we initialize from
            # a resultset dict
            trs_struct = TreeherderResultSet(resultset)

            self.compare_structs(trs_struct.data, resultset)
開發者ID:samh12,項目名稱:treeherder,代碼行數:39,代碼來源:test_treeherder_client.py

示例13: test_send_result_collection

# 需要導入模塊: from treeherder.client import TreeherderResultSetCollection [as 別名]
# 或者: from treeherder.client.TreeherderResultSetCollection import add [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.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。