def test_call_without_dry_run(self, delete):
        """make_cancel_request should call requests.delete."""
        buildapi_client.make_cancel_request("repo", "1234567", auth=None, dry_run=False)

        # We expect that make_cancel_request will call requests.delete
        # once with the following arguments
        delete.assert_called_once_with(
            '%s/%s/request/%s' % (HOST_ROOT, "repo", "1234567"),
            auth=None)
Esempio n. 2
0
 def cancel(self, uuid, *args, **kwargs):
     return make_cancel_request(
         repo_name=kwargs['repo_name'],
         request_id=uuid,
         auth=get_credentials(),
         *args,
         **kwargs)
 def test_call_with_dry_run(self, delete):
     """make_cancel_request should return None when dry_run is True."""
     self.assertEquals(
         buildapi_client.make_cancel_request("repo", "1234567", auth=None, dry_run=True), None)
     # make_cancel_request should not call requests.delete when dry_run is True
     assert delete.call_count == 0
Esempio n. 4
0
 def cancel(self, uuid, *args, **kwargs):
     return make_cancel_request(repo_name=kwargs['repo_name'],
                                request_id=uuid,
                                auth=get_credentials(),
                                *args,
                                **kwargs)