Skip to content
Snippets Groups Projects
Commit aac126bae6b9 authored by Georges Racinet's avatar Georges Racinet
Browse files

Merge Requests: new tests for merged and closed branches

Done as a parametrization of the existing `test_cli_named_branch`.

Because now the GitLab branch can be pruned, we move that
assertion from the helper function to the actual test cases.
parent 7f98bac48dce
No related branches found
No related tags found
1 merge request!39New tests for Heptapod 0.13.1
Pipeline #6736 failed
......@@ -170,8 +170,6 @@
lambda branches: source_branch not in branches)
else:
assert source_branch == 'branch/' + named_branch
# named branches can't be deleted (well, we could close it)
assert source_branch in project.api_branches()
def api_accept_merge_request(proj, mr_id, check_merged=True, **opts):
......@@ -820,7 +818,8 @@
"Commit summaries don't contain %r" % expected)
def test_mergerequest_cli_named_branch(public_project, tmpdir):
@parametrize('close', ('no-close', 'close-before', 'close-after'))
def test_mergerequest_cli_named_branch(public_project, tmpdir, close):
"""Accepting the MR for a named branch via CLI (no rebase).
Using public_project for ASCII testing of the user (full) name,
......@@ -836,6 +835,8 @@
branch = prepare_named_branch(repo)
mr_id = create_mr(public_project, named_branch=branch)
if close == 'close-before':
repo.hg('commit', '--close-branch', '-m', 'Closing before')
repo.hg('update', 'default')
repo.hg('merge', 'gnu')
repo.hg('commit', '-m', "Merged gnu into default through CLI")
......@@ -839,5 +840,8 @@
repo.hg('update', 'default')
repo.hg('merge', 'gnu')
repo.hg('commit', '-m', "Merged gnu into default through CLI")
if close == 'close-after':
repo.hg('update', 'gnu')
repo.hg('commit', '--close-branch', '-m', 'Closing after')
repo.hg('phase', '-p', '.')
repo.hg('push')
......@@ -842,6 +846,6 @@
repo.hg('phase', '-p', '.')
repo.hg('push')
print("Graph after API merge:")
print("Graph after CLI merge:")
print(repo.graphlog(hidden=True))
assert_merge_detected(public_project, mr_id, named_branch=branch)
......@@ -851,6 +855,9 @@
assert any(expected in l.text for l in commit_links), (
"Commit summaries don't contain %r" % expected)
branches = public_project.api_branch_titles()
assert ('branch/gnu' in branches) is (close == 'no-close')
def test_mergerequest_cli_named_branch_slash(public_project, tmpdir):
"""Test for forward slash in branch name.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment