Read about our upcoming Code of Conduct on this issue

Commit e56d0995 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Project: new api_fork() method

Proper testing of Git operation will need this.
parent 53b9d19169dd
......@@ -527,6 +527,31 @@ class Project(object):
assert split_url[-2] == 'merge_requests'
return int(split_url[-1])
def api_fork(self, user, group=None):
data = dict(
if group is None:
group = UserNameSpace(, heptapod=self.heptapod)
data['namespace_id'] =
resp = self.api_request('POST', user, subpath='fork', data=data)
assert resp.status_code < 400
fork_info = resp.json()
owner_info = fork_info.get('owner')
if owner_info is not None:
assert owner_info['username'] ==
fork = self.__class__(
group=group, name=fork_info['path'],
return wait_assert(
lambda: fork,
lambda proj: proj.api_get_field('import_status') == 'finished'
def api_create_merge_request(self, source,
title='Created through API'):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment