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

Tests for the base `Servicer` class

actually should have been committed with 5cca85c5e7f5
parent 3648a95f
No related branches found
No related tags found
Loading
Pipeline #7109 passed with warnings
# Copyright 2020 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
from mercurial import pycompat
from heptapod.testhelpers import (
LocalRepoWrapper,
)
from ..servicer import HGitalyServicer
from ..stub.shared_pb2 import (
Repository,
)
def test_load_repo(tmpdir):
storage_root = tmpdir.join('repos')
storage_root_bytes = pycompat.sysbytes(str(storage_root))
servicer = HGitalyServicer(dict(storname=storage_root_bytes))
wrapper = LocalRepoWrapper.init(storage_root.join('awesome-proj.hg'))
loaded = servicer.load_repo(Repository(storage_name='storname',
relative_path='awesome-proj.hg'))
assert loaded.root == wrapper.repo.root
# In practice, requests from the Rails app will assume the relevant
# path to end in `.git`, we need to ignore that.
loaded = servicer.load_repo(Repository(storage_name='storname',
relative_path='awesome-proj.git'))
assert loaded.root == wrapper.repo.root
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