def create_checkout_key(self, username, project, key_type, vcs_type='github'): """Create a new checkout keys for a project :param username: Org or user name. :param project: Case sensitive repo name. :param key_type: The type of key to create. Valid values are \ 'deploy-key' or 'github-user-key' :param vcs_type: Defaults to github. On circleci.com you can \ also pass in ``bitbucket``. :raises InvalidKeyError: When key_type is not a valid key type. Endpoint: POST: ``/project/:vcs-type/:username/:project/checkout-key`` """ valid_types = ['deploy-key', 'github-user-key'] if key_type not in valid_types: raise BadKeyError(key_type) params = {"type": key_type} endpoint = 'project/{0}/{1}/{2}/checkout-key'.format( vcs_type, username, project) resp = self._request('POST', endpoint, data=params) return resp
def setUp(self): self.base = CircleCIException('fake') self.key = BadKeyError('fake') self.verb = BadVerbError('fake') self.filter = InvalidFilterError('fake', 'status') self.afilter = InvalidFilterError('fake', 'artifacts')