def test_post_job_collection(self): """Can add a treeherder collections to a TreeherderRequest.""" tjc = TreeherderJobCollection() for job in self.job_data: tjc.add(tjc.get_job(job)) client = TreeherderClient( server_url='http://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, tjc.get_collection_data()) return (200, {}, '{"message": "Job successfully updated"}') url = client._get_endpoint_url(tjc.endpoint_base, project='project') responses.add_callback(responses.POST, url, match_querystring=True, callback=request_callback, content_type='application/json') client.post_collection('project', tjc)
def completed_jobs_stored(test_repository, failure_classifications, completed_jobs, push_stored): """ stores a list of buildapi completed jobs """ completed_jobs['revision'] = push_stored[0]['revision'] completed_jobs.update({'project': test_repository.name}) tjc = TreeherderJobCollection() tj = tjc.get_job(completed_jobs) tjc.add(tj) store_job_data(test_repository, tjc.get_collection_data())
def running_jobs_stored(test_repository, failure_classifications, running_jobs, push_stored): """ stores a list of buildapi running jobs """ running_jobs.update(push_stored[0]) running_jobs.update({'project': test_repository.name}) tjc = TreeherderJobCollection() tj = tjc.get_job(running_jobs) tjc.add(tj) store_job_data(test_repository, tjc.get_collection_data())
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)
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)
def pending_jobs_stored(test_repository, failure_classifications, pending_jobs, push_stored): """ stores a list of buildapi pending jobs into the jobs store """ pending_jobs.update(push_stored[0]) pending_jobs.update({'project': test_repository.name}) tjc = TreeherderJobCollection() tj = tjc.get_job(pending_jobs) tjc.add(tj) store_job_data(test_repository, tjc.get_collection_data())
def completed_jobs_stored( test_repository, failure_classifications, completed_jobs, push_stored, mock_post_json): """ stores a list of buildapi completed jobs """ completed_jobs['revision'] = push_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)
def running_jobs_stored( test_repository, failure_classifications, running_jobs, push_stored, mock_post_json): """ stores a list of buildapi running jobs """ running_jobs.update(push_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)
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)
def pending_jobs_stored( test_repository, failure_classifications, pending_jobs, push_stored): """ stores a list of buildapi pending jobs into the jobs store """ pending_jobs.update(push_stored[0]) pending_jobs.update({'project': test_repository.name}) tjc = TreeherderJobCollection() tj = tjc.get_job(pending_jobs) tjc.add(tj) store_job_data(test_repository, tjc.get_collection_data())
def pending_jobs_stored( test_repository, failure_classifications, pending_jobs, push_stored, mock_post_json): """ stores a list of buildapi pending jobs into the jobs store using BuildApiTreeHerderAdapter """ pending_jobs.update(push_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)
def test_post_job_collection(self): """Can add a treeherder collections to a TreeherderRequest.""" tjc = TreeherderJobCollection() for job in self.job_data: tjc.add(tjc.get_job(job)) client = TreeherderClient( server_url='http://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, tjc.get_collection_data()) return (200, {}, '{"message": "Job successfully updated"}') url = client._get_endpoint_url(tjc.endpoint_base, project='project') responses.add_callback(responses.POST, url, match_querystring=True, callback=request_callback, content_type='application/json') client.post_collection('project', tjc)