This instance will be upgraded to Heptapod 0.23.2 on 2021-08-05 at 11:00 UTC+2 (a few minutes of down time)

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

Native migration: test for Git SHA fallback.

Related to heptapod#421
parent 5e11f32afbdb
Pipeline #22303 waiting for manual action with stages
in 9 seconds
# Copyright 2021 Georges Racinet <georges.racinet@octobus.net>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
#
# SPDX-License-Identifier: GPL-2.0-or-later
"""Tests for migration to native Mercurial repositories."""
from .utils import (
assert_webdriver_not_error,
needs,
)
from .test_push import prepare_simple_repo
@needs.sql
@needs.hg_git # test starts from a hg_git project
def test_commit_page_fallback(test_project, tmpdir):
proj = test_project
prepare_simple_repo(proj, tmpdir.join('repo'))
commit = proj.api_branches()['topic/default/zetop']['commit']
git_sha, hg_sha = commit['id'], commit['hg_id']
assert git_sha != hg_sha # make sure test stays relevant
# cannot change vcs_type from API, and that's a good thing.
# That it makes these tests not work on remote Heptapod instances
# is a minor inconvenience.
proj.heptapod.psql(
"UPDATE projects SET vcs_type='hg' WHERE id=%d" % proj.id)
native_commit = proj.api_branches()['topic/default/zetop']['commit']
assert native_commit['id'] == hg_sha
webdriver = proj.owner_webdriver
webdriver.get('/'.join((proj.url, '-', 'commit', git_sha)))
assert_webdriver_not_error(webdriver)
page = webdriver.page_source
assert 'Commit 1' in page
assert hg_sha[:8] in page
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