本文整理汇总了Python中tests.test_utils.post_collection函数的典型用法代码示例。如果您正苦于以下问题:Python post_collection函数的具体用法?Python post_collection怎么用?Python post_collection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了post_collection函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_post_job_with_buildapi_artifact
def test_post_job_with_buildapi_artifact(test_repository, failure_classifications,
result_set_stored,
mock_post_json):
"""
test submitting a job with a buildapi artifact gets that stored (and
we update the job object)
"""
tjc = client.TreeherderJobCollection()
job_guid = 'd22c74d4aa6d2a1dcba96d95dccbd5fdca70cf33'
tj = client.TreeherderJob({
'project': test_repository.name,
'revision': result_set_stored[0]['revision'],
'job': {
'artifacts': [],
'job_guid': job_guid,
'state': 'completed',
}
})
tj.add_artifact("buildapi", "json",
json.dumps({"buildername": "Windows 8 64-bit cheezburger",
"request_id": 1234}))
tjc.add(tj)
post_collection(test_repository.name, tjc)
assert Job.objects.count() == 1
assert JobDetail.objects.count() == 1
buildbot_request_id_detail = JobDetail.objects.all()[0]
assert buildbot_request_id_detail.title == 'buildbot_request_id'
assert buildbot_request_id_detail.value == str(1234)
assert buildbot_request_id_detail.url is None
开发者ID:SebastinSanty,项目名称:treeherder,代码行数:31,代码来源:test_client_job_ingestion.py
示例2: test_post_job_with_text_log_summary_and_bug_suggestions_artifact
def test_post_job_with_text_log_summary_and_bug_suggestions_artifact(
test_project,
monkeypatch,
result_set_stored,
mock_post_json,
mock_error_summary,
text_log_summary_dict,
):
"""
test submitting a job with a pre-parsed log and both artifacts
does not generate parse the log or generate any artifacts, just uses
the supplied ones.
"""
mock_parse = MagicMock(name="parse_line")
monkeypatch.setattr(StepParser, 'parse_line', mock_parse)
mock_get_error_summary = MagicMock(name="get_error_summary_artifacts")
monkeypatch.setattr(error_summary, 'get_error_summary_artifacts', mock_get_error_summary)
error_summary_blob = ["fee", "fie", "foe", "fum"]
job_guid = 'd22c74d4aa6d2a1dcba96d95dccbd5fdca70cf33'
tjc = client.TreeherderJobCollection()
tj = client.TreeherderJob({
'project': test_project,
'revision': result_set_stored[0]['revision'],
'job': {
'job_guid': job_guid,
'state': 'completed',
'log_references': [{
'url': 'http://ftp.mozilla.org/pub/mozilla.org/spidermonkey/...',
'name': 'buildbot_text',
'parse_status': 'parsed'
}],
'artifacts': [
{
"blob": json.dumps(text_log_summary_dict),
"type": "json",
"name": "text_log_summary",
"job_guid": job_guid
},
{
"blob": json.dumps(error_summary_blob),
"type": "json",
"name": "Bug suggestions",
"job_guid": job_guid
},
]
}
})
tjc.add(tj)
post_collection(test_project, tjc)
check_artifacts(test_project, job_guid, 'parsed', 2,
{'Bug suggestions', 'text_log_summary'}, error_summary_blob)
assert mock_parse.called is False
assert mock_get_error_summary.called is False
开发者ID:anurag619,项目名称:treeherder,代码行数:60,代码来源:test_client_job_ingestion.py
示例3: test_resultset_create
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,代码行数:30,代码来源:test_resultset_api.py
示例4: test_resultset_create
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,代码行数:27,代码来源:test_resultset_api.py
示例5: test_post_talos_artifact
def test_post_talos_artifact(test_project, test_repository, result_set_stored,
mock_post_json):
test_repository.save()
tjc = client.TreeherderJobCollection()
job_guid = 'd22c74d4aa6d2a1dcba96d95dccbd5fdca70cf33'
tj = client.TreeherderJob({
'project': test_repository.name,
'revision_hash': result_set_stored[0]['revision_hash'],
'job': {
'job_guid': job_guid,
'state': 'completed',
'project': test_repository.name,
'option_collection': {'opt': True},
'artifacts': [{
'blob': {'talos_data': SampleData.get_minimal_talos_perf_data()},
'type': 'json',
'name': 'talos_data',
'job_guid': job_guid
}]
}
})
tjc.add(tj)
post_collection(test_project, tjc)
# we'll just validate that we got the expected number of results for
# talos (we have validation elsewhere for the actual data adapters)
assert PerformanceSignature.objects.count() == 1
assert PerformanceDatum.objects.count() == 1
开发者ID:PratikDhanave,项目名称:treeherder,代码行数:31,代码来源:test_perf_ingestion.py
示例6: running_jobs_stored
def running_jobs_stored(
jm, running_jobs, result_set_stored):
"""
stores a list of buildapi running jobs into the objectstore
"""
running_jobs.update(result_set_stored[0])
tjc = TreeherderJobCollection(job_type='update')
tj = tjc.get_job(running_jobs)
tjc.add(tj)
test_utils.post_collection(jm.project, tjc)
开发者ID:klibby,项目名称:treeherder-service,代码行数:12,代码来源:conftest.py
示例7: completed_jobs_stored
def completed_jobs_stored(
jm, completed_jobs, result_set_stored, mock_send_request):
"""
stores a list of buildapi completed jobs into the objectstore
"""
completed_jobs['revision_hash'] = result_set_stored[0]['revision_hash']
tjc = TreeherderJobCollection()
tj = tjc.get_job(completed_jobs)
tjc.add(tj)
test_utils.post_collection(jm.project, tjc)
开发者ID:klibby,项目名称:treeherder-service,代码行数:12,代码来源:conftest.py
示例8: completed_jobs_stored
def completed_jobs_stored(
jm, completed_jobs, result_set_stored, mock_post_json):
"""
stores a list of buildapi completed jobs
"""
completed_jobs['revision'] = result_set_stored[0]['revision']
completed_jobs.update({'project': jm.project})
tjc = TreeherderJobCollection()
tj = tjc.get_job(completed_jobs)
tjc.add(tj)
test_utils.post_collection(jm.project, tjc)
开发者ID:anurag619,项目名称:treeherder,代码行数:13,代码来源:conftest.py
示例9: running_jobs_stored
def running_jobs_stored(
jm, running_jobs, result_set_stored, mock_post_json):
"""
stores a list of buildapi running jobs
"""
running_jobs.update(result_set_stored[0])
running_jobs.update({'project': jm.project})
tjc = TreeherderJobCollection()
tj = tjc.get_job(running_jobs)
tjc.add(tj)
test_utils.post_collection(jm.project, tjc)
开发者ID:anurag619,项目名称:treeherder,代码行数:13,代码来源:conftest.py
示例10: pending_jobs_stored
def pending_jobs_stored(
jm, pending_jobs, result_set_stored):
"""
stores a list of buildapi pending jobs into the jobs store
using BuildApiTreeHerderAdapter
"""
pending_jobs.update(result_set_stored[0])
tjc = TreeherderJobCollection(job_type='update')
tj = tjc.get_job(pending_jobs)
tjc.add(tj)
test_utils.post_collection(jm.project, tjc)
开发者ID:klibby,项目名称:treeherder-service,代码行数:14,代码来源:conftest.py
示例11: running_jobs_stored
def running_jobs_stored(
test_repository, failure_classifications, running_jobs,
result_set_stored, mock_post_json):
"""
stores a list of buildapi running jobs
"""
running_jobs.update(result_set_stored[0])
running_jobs.update({'project': test_repository.name})
tjc = TreeherderJobCollection()
tj = tjc.get_job(running_jobs)
tjc.add(tj)
test_utils.post_collection(test_repository.name, tjc)
开发者ID:SebastinSanty,项目名称:treeherder,代码行数:14,代码来源:conftest.py
示例12: completed_jobs_stored
def completed_jobs_stored(
test_repository, failure_classifications, completed_jobs,
result_set_stored, mock_post_json):
"""
stores a list of buildapi completed jobs
"""
completed_jobs['revision'] = result_set_stored[0]['revision']
completed_jobs.update({'project': test_repository.name})
tjc = TreeherderJobCollection()
tj = tjc.get_job(completed_jobs)
tjc.add(tj)
test_utils.post_collection(test_repository.name, tjc)
开发者ID:SebastinSanty,项目名称:treeherder,代码行数:14,代码来源:conftest.py
示例13: test_post_job_with_text_log_summary_artifact_pending
def test_post_job_with_text_log_summary_artifact_pending(
test_repository,
failure_classifications,
result_set_stored,
monkeypatch,
mock_post_json,
text_log_summary_dict,
):
"""
test submitting a job with a log set to pending, but with a text_log_summary.
This should detect the artifact, not parse, and just mark the log as parsed,
then generate bug suggestions.
"""
mock_parse = MagicMock(name="parse_line")
monkeypatch.setattr(StepParser, 'parse_line', mock_parse)
job_guid = 'd22c74d4aa6d2a1dcba96d95dccbd5fdca70cf33'
tjc = client.TreeherderJobCollection()
tj = client.TreeherderJob({
'project': test_repository.name,
'revision': result_set_stored[0]['revision'],
'job': {
'job_guid': job_guid,
'state': 'completed',
'log_references': [{
'url': 'http://ftp.mozilla.org/pub/mozilla.org/spidermonkey/...',
'name': 'buildbot_text',
'parse_status': 'pending'
}],
'artifacts': [{
"blob": json.dumps(text_log_summary_dict),
"type": "json",
"name": "text_log_summary",
"job_guid": job_guid
}]
}
})
tjc.add(tj)
post_collection(test_repository.name, tjc)
# should have 4 error summary lines (aka bug suggestions)
assert len(get_error_summary(Job.objects.get(guid=job_guid))) == 4
# ensure the parsing didn't happen
assert mock_parse.called is False
开发者ID:SebastinSanty,项目名称:treeherder,代码行数:49,代码来源:test_client_job_ingestion.py
示例14: test_objectstore_create
def test_objectstore_create(job_sample, jm):
"""
test posting data to the objectstore via webtest.
extected result are:
- return code 200
- return message successful
- 1 job stored in the objectstore
"""
tjc = TreeherderJobCollection()
tj = tjc.get_job(job_sample)
tjc.add(tj)
resp = test_utils.post_collection(jm.project, tjc)
assert resp.status_int == 200
assert resp.json['message'] == 'well-formed JSON stored'
stored_objs = jm.get_os_dhub().execute(
proc="objectstore_test.selects.row_by_guid",
placeholders=[job_sample["job"]["job_guid"]]
)
assert len(stored_objs) == 1
assert stored_objs[0]['job_guid'] == job_sample["job"]["job_guid"]
jm.disconnect()
开发者ID:TheTeraByte,项目名称:treeherder,代码行数:28,代码来源:test_objectstore_api.py
示例15: test_resultset_create
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,代码行数:29,代码来源:test_resultset_api.py
示例16: pending_jobs_stored
def pending_jobs_stored(
test_repository, failure_classifications, pending_jobs,
result_set_stored, mock_post_json):
"""
stores a list of buildapi pending jobs into the jobs store
using BuildApiTreeHerderAdapter
"""
pending_jobs.update(result_set_stored[0])
pending_jobs.update({'project': test_repository.name})
tjc = TreeherderJobCollection()
tj = tjc.get_job(pending_jobs)
tjc.add(tj)
test_utils.post_collection(test_repository.name, tjc)
开发者ID:SebastinSanty,项目名称:treeherder,代码行数:16,代码来源:conftest.py
示例17: test_resultset_create
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,代码行数:35,代码来源:test_resultset_api.py
示例18: test_post_job_with_text_log_summary_artifact_parsed_dict_blob
def test_post_job_with_text_log_summary_artifact_parsed_dict_blob(
test_project,
monkeypatch,
result_set_stored,
mock_post_json,
mock_error_summary,
text_log_summary_dict,
):
"""
test submitting a job with a pre-parsed log gets parse_status of
"parsed" and doesn't parse the log, but still generates
the bug suggestions.
"""
mock_parse = MagicMock(name="parse_line")
monkeypatch.setattr(StepParser, 'parse_line', mock_parse)
job_guid = 'd22c74d4aa6d2a1dcba96d95dccbd5fdca70cf33'
tjc = client.TreeherderJobCollection()
tj = client.TreeherderJob({
'project': test_project,
'revision': result_set_stored[0]['revision'],
'job': {
'job_guid': job_guid,
'state': 'completed',
'log_references': [{
'url': 'http://ftp.mozilla.org/pub/mozilla.org/spidermonkey/...',
'name': 'buildbot_text',
'parse_status': 'parsed'
}],
'artifacts': [{
"blob": text_log_summary_dict,
"type": "json",
"name": "text_log_summary",
"job_guid": job_guid
}]
}
})
tjc.add(tj)
post_collection(test_project, tjc)
check_artifacts(test_project, job_guid, 'parsed', 2,
{'Bug suggestions', 'text_log_summary'}, mock_error_summary)
# ensure the parsing didn't happen
assert mock_parse.called is False
开发者ID:anurag619,项目名称:treeherder,代码行数:47,代码来源:test_client_job_ingestion.py
示例19: test_post_perf_artifact_multiple
def test_post_perf_artifact_multiple(test_repository,
failure_classifications,
push_stored, mock_post_json):
PerformanceFramework.objects.get_or_create(name='cheezburger', enabled=True)
perfobj = {
"framework": {"name": "cheezburger"},
"suites": [{
"name": "cheezburger metrics",
"value": 10.0,
"subtests": [
{"name": "test1", "value": 20.0},
{"name": "test2", "value": 30.0}
]
}]
}
perfobj2 = copy.deepcopy(perfobj)
perfobj2['suites'][0]['name'] = "cheezburger metrics 2"
tjc = client.TreeherderJobCollection()
job_guid = 'd22c74d4aa6d2a1dcba96d95dccbd5fdca70cf33'
tj = client.TreeherderJob({
'project': test_repository.name,
'revision': push_stored[0]['revision'],
'job': {
'job_guid': job_guid,
'state': 'completed',
'project': test_repository.name,
'option_collection': {'opt': True},
'artifacts': [{
'blob': {
"performance_data": [perfobj, perfobj2]
},
'type': 'json',
'name': 'performance_data',
'job_guid': job_guid
}]
}
})
tjc.add(tj)
post_collection(test_repository.name, tjc)
# we'll just validate that we got the expected number of results
# (we have validation elsewhere for the actual data adapters)
assert PerformanceSignature.objects.all().count() == 6
assert PerformanceDatum.objects.all().count() == 6
开发者ID:MikeLing,项目名称:treeherder,代码行数:46,代码来源:test_perf_ingestion.py
示例20: test_post_job_pending_to_completed_with_unparsed_log
def test_post_job_pending_to_completed_with_unparsed_log(test_repository,
result_set_stored,
failure_classifications,
mock_post_json):
job_guid = 'd22c74d4aa6d2a1dcba96d95dccbd5fdca70cf33'
# the first time, submit it as running (with no logs)
tjc = client.TreeherderJobCollection()
tj = client.TreeherderJob({
'project': test_repository.name,
'revision': result_set_stored[0]['revision'],
'job': {
'job_guid': job_guid,
'state': 'running'
}
})
tjc.add(tj)
post_collection(test_repository.name, tjc)
# should have no text log errors or bug suggestions
assert TextLogError.objects.count() == 0
assert len(get_error_summary(Job.objects.get(guid=job_guid))) == 0
# the second time, post a log that will get parsed
log_url = "file://{0}".format(
SampleData().get_log_path("mozilla-central-macosx64-debug-bm65-build1-build15.txt.gz"))
tjc = client.TreeherderJobCollection()
tj = client.TreeherderJob({
'project': test_repository.name,
'revision': result_set_stored[0]['revision'],
'job': {
'job_guid': job_guid,
'state': 'completed',
'log_references': [{
'url': log_url,
'name': 'buildbot_text',
'parse_status': 'pending'
}]
}
})
tjc.add(tj)
post_collection(test_repository.name, tjc)
# should have a full set of text log errors
assert TextLogError.objects.count() == 2
assert len(get_error_summary(Job.objects.get(guid=job_guid))) == 2
开发者ID:SebastinSanty,项目名称:treeherder,代码行数:46,代码来源:test_client_job_ingestion.py
注:本文中的tests.test_utils.post_collection函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论