From 838e816a65b6ee0e43cdc2698bd5d2e1f0aacfdf Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Wed, 23 Jul 2014 12:19:22 +0200 Subject: [PATCH] Don't influence user's homedir --- tests/test_cli.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index dfa2d0a..8e0d207 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -15,9 +15,11 @@ import vdirsyncer.cli as cli def test_load_config(tmpdir, monkeypatch): f = tmpdir.join('test.cfg') + status_path = '{}/status/'.format(str(tmpdir)) + contacts_path = '{}/contacts/'.format(str(tmpdir)) f.write(dedent(''' [general] - status_path = ~/.vdirsyncer/status/ + status_path = {status} foo = 1 [pair bob] @@ -28,7 +30,7 @@ def test_load_config(tmpdir, monkeypatch): [storage bob_a] type = filesystem - path = ~/.contacts/ + path = {contacts} fileext = .vcf yesno = off number = 42 @@ -38,16 +40,16 @@ def test_load_config(tmpdir, monkeypatch): [bogus] lol = true - ''').strip()) + ''').strip().format(status=status_path, contacts=contacts_path)) fname = str(tmpdir) + '/test.cfg' errors = [] monkeypatch.setattr('vdirsyncer.cli.cli_logger.error', errors.append) general, pairs, storages = cli.load_config(fname, pair_options=('bam',)) - assert general == {'foo': 1, 'status_path': '~/.vdirsyncer/status/'} + assert general == {'foo': 1, 'status_path': status_path} assert pairs == {'bob': ('bob_a', 'bob_b', {'bam': True}, {'foo': 'bar'})} assert storages == { - 'bob_a': {'type': 'filesystem', 'path': '~/.contacts/', + 'bob_a': {'type': 'filesystem', 'path': contacts_path, 'fileext': '.vcf', 'yesno': False, 'number': 42}, 'bob_b': {'type': 'carddav'} }