Commit 83ddc799 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

merge requests: tests for squash

this time we parametrize our three fast-forward cases in a
single test method
parent d55aaceddc1c
Pipeline #5436 failed with stages
in 11 minutes and 17 seconds
......@@ -399,6 +399,51 @@ def test_mergerequest_api_explicit_merge_message(test_project, tmpdir,
"Commit summaries don't contain %r" % expected)
@parametrize('fast_forward', ['no', 'de facto', 'required'])
def test_mergerequest_api_squash(test_project, tmpdir, fast_forward):
"""Accepting the MR via API with squash
linear = fast_forward != 'no'
if fast_forward == 'required':
repo = hg.LocalRepo.init(tmpdir.join('repo'),
topic = prepare_topic(repo, needing_rebase=not linear)
# let's add another changeset in topic
repo.path.join('antelope').write("Gnus are antelopes!\n", mode='a')
repo.hg('commit', '-Am', "Gnus are no exceptions",
'--user', 'Raphaël <raphael@heptapod.test>')
mr_id = create_mr(test_project, topic=topic)
resp = api_accept_merge_request(
test_project, mr_id, check_merged=False,
squash_commit_message="Antelopes including gnus"
assert resp.status_code == 200
# squash operation can be async. It's not really detection, but
# it's about the MR state being 'merged' after a while.
assert_merge_detected(test_project, mr_id)
repo.hg('pull', test_project.owner_basic_auth_url)
# don't stay on obsolete changesets, lest we pollute the log
repo.hg('up', 'default')
print("Graph after API merge:")
log = repo.hg('log', '-T', '{desc|firstline}:{phase}\n')
expected = ["Antelopes including gnus:public",
"Initial sentence:public"]
if not linear:
expected.insert(1, "Even a horse!:public")
expected.insert(0, "Merge branch 'topic/default/antelope' "
"into 'branch/default':public")
assert log.splitlines() == expected
def test_mergerequest_api_conflict(test_project, tmpdir):
repo = hg.LocalRepo.init(tmpdir.join('repo'),
Supports Markdown
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