def test_bad_response(self, remove_credentials, get_credentials, post):
     """trigger_arbitrary_job should raise an AssertionError if it receives a bad response."""
     with self.assertRaises(AuthenticationError):
         buildapi.trigger_arbitrary_job("repo",
                                        "builder",
                                        "123456123456",
                                        dry_run=False)
 def test_call_without_dry_run(self, get_credentials, post):
     """trigger_arbitrary_job should call requests.post."""
     buildapi.trigger_arbitrary_job("repo", "builder", "123456123456", dry_run=False)
     # We expect that trigger_arbitrary_job will call requests.post
     # once with the following arguments
     post.assert_called_once_with(
         '%s/%s/builders/%s/%s' % (buildapi.HOST_ROOT, "repo", "builder", "123456123456"),
         headers={'Accept': 'application/json'},
         data={'properties':
               '{"branch": "repo", "revision": "123456123456"}'},
         auth=get_credentials())
Exemplo n.º 3
0
 def schedule_arbitrary_job(self, repo_name, revision, uuid, *args,
                            **kwargs):
     return buildapi.trigger_arbitrary_job(repo_name=repo_name,
                                           builder=uuid,
                                           revision=revision,
                                           *args,
                                           **kwargs)
 def test_call_without_dry_run(self, get_credentials, post):
     """trigger_arbitrary_job should call requests.post."""
     buildapi.trigger_arbitrary_job("repo",
                                    "builder",
                                    "123456123456",
                                    dry_run=False)
     # We expect that trigger_arbitrary_job will call requests.post
     # once with the following arguments
     post.assert_called_once_with(
         '%s/%s/builders/%s/%s' %
         (buildapi.HOST_ROOT, "repo", "builder", "123456123456"),
         headers={'Accept': 'application/json'},
         data={
             'properties': '{"branch": "repo", "revision": "123456123456"}'
         },
         auth=get_credentials())
Exemplo n.º 5
0
def trigger(builder, revision, files=[], dry_run=False, extra_properties=None):
    """Helper to trigger a job.

    Returns a request.
    """
    repo_name = query_repo_name_from_buildername(builder)
    return buildapi.trigger_arbitrary_job(repo_name, builder, revision, files, dry_run,
                                          extra_properties)
 def test_call_with_dry_run(self, get_credentials, post):
     """trigger_arbitrary_job should return None when dry_run is True."""
     self.assertEquals(
         buildapi.trigger_arbitrary_job("repo",
                                        "builder",
                                        "123456123456",
                                        dry_run=True), None)
     # trigger_arbitrary_job should not call requests.post when dry_run is True
     assert post.call_count == 0
Exemplo n.º 7
0
def trigger(builder, revision, files=[], dry_run=False, extra_properties=None):
    """Helper to trigger a job.

    Returns a request.
    """
    global SCHEDULING_MANAGER
    sch_mgr = SCHEDULING_MANAGER

    if revision not in sch_mgr:
        sch_mgr[revision] = []

    sch_mgr[revision].append(builder)

    repo_name = query_repo_name_from_buildername(builder)
    return buildapi.trigger_arbitrary_job(repo_name, builder, revision, files,
                                          dry_run, extra_properties)
Exemplo n.º 8
0
def trigger(builder, revision, files=[], dry_run=False, extra_properties=None):
    """Helper to trigger a job.

    Returns a request.
    """
    global SCHEDULING_MANAGER
    sch_mgr = SCHEDULING_MANAGER

    if revision not in sch_mgr:
        sch_mgr[revision] = []

    sch_mgr[revision].append(builder)

    repo_name = query_repo_name_from_buildername(builder)
    return buildapi.trigger_arbitrary_job(repo_name, builder, revision, files, dry_run,
                                          extra_properties)
Exemplo n.º 9
0
 def schedule_arbitrary_job(self, repo_name, revision, uuid, *args, **kwargs):
     return buildapi.trigger_arbitrary_job(repo_name=repo_name,
                                           builder=uuid,
                                           revision=revision,
                                           *args,
                                           **kwargs)
Exemplo n.º 10
0
 def test_bad_response(self, remove_credentials, get_credentials, post):
     """trigger_arbitrary_job should raise an AssertionError if it receives a bad response."""
     with self.assertRaises(AuthenticationError):
         buildapi.trigger_arbitrary_job("repo", "builder", "123456123456", dry_run=False)
Exemplo n.º 11
0
 def test_call_with_dry_run(self, get_credentials, post):
     """trigger_arbitrary_job should return None when dry_run is True."""
     self.assertEquals(
         buildapi.trigger_arbitrary_job("repo", "builder", "123456123456", dry_run=True), None)
     # trigger_arbitrary_job should not call requests.post when dry_run is True
     assert post.call_count == 0