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

MercurialRepositoryService tests: modernized with fixture

Will be nicer for the forthcoming tests
parent 95f106af
No related branches found
No related tags found
1 merge request!133Mercurial config management methods
......@@ -30,6 +30,9 @@
MercurialRepositoryServiceStub,
)
from .fixture import ServiceFixture
parametrize = pytest.mark.parametrize
......@@ -33,7 +36,10 @@
parametrize = pytest.mark.parametrize
def test_config_item(grpc_channel, server_repos_root):
hg_repo_stub = MercurialRepositoryServiceStub(grpc_channel)
wrapper, grpc_repo = make_empty_repo(server_repos_root)
class ConfigFixture(ServiceFixture):
stub_cls = MercurialRepositoryServiceStub
def config_item(self, **kw):
return self.stub.GetConfigItem(
GetConfigItemRequest(repository=self.grpc_repo, **kw))
......@@ -39,11 +45,19 @@
def rpc_config_bool(section, name):
return hg_repo_stub.GetConfigItem(
GetConfigItemRequest(repository=grpc_repo,
section=section,
name=name,
as_type=ConfigItemType.BOOL)
).as_bool
def config_bool(self, section, name):
return self.config_item(as_type=ConfigItemType.BOOL,
section=section,
name=name,
).as_bool
@pytest.fixture
def config_fixture(grpc_channel, server_repos_root):
with ConfigFixture(grpc_channel, server_repos_root) as fixture:
yield fixture
def test_config_item(config_fixture):
rpc_config_bool = config_fixture.config_bool
# Relying on current defaults in some random core settings, just pick
# some other ones if they change.
......
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