예제 #1
0
    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 test_job_collection(self):
        """Confirm the collection matches the sample data"""
        tjc = TreeherderJobCollection()

        for job in self.job_data:
            tj = TreeherderJob(job)
            tjc.add(tj)

        self.assertTrue(len(self.job_data) == len(tjc.data))
예제 #3
0
    def test_job_collection(self):
        """Confirm the collection matches the sample data"""
        tjc = TreeherderJobCollection()

        for job in self.job_data:
            tj = TreeherderJob(job)
            tjc.add(tj)

        self.assertTrue(len(self.job_data) == len(tjc.data))
예제 #4
0
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())
예제 #5
0
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())
예제 #6
0
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)
예제 #7
0
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)
예제 #8
0
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())
예제 #9
0
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)
예제 #10
0
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)
예제 #11
0
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)
예제 #12
0
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())
예제 #13
0
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)