mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Don't influence user's homedir
This commit is contained in:
parent
d263a399f3
commit
838e816a65
1 changed files with 7 additions and 5 deletions
|
|
@ -15,9 +15,11 @@ import vdirsyncer.cli as cli
|
||||||
|
|
||||||
def test_load_config(tmpdir, monkeypatch):
|
def test_load_config(tmpdir, monkeypatch):
|
||||||
f = tmpdir.join('test.cfg')
|
f = tmpdir.join('test.cfg')
|
||||||
|
status_path = '{}/status/'.format(str(tmpdir))
|
||||||
|
contacts_path = '{}/contacts/'.format(str(tmpdir))
|
||||||
f.write(dedent('''
|
f.write(dedent('''
|
||||||
[general]
|
[general]
|
||||||
status_path = ~/.vdirsyncer/status/
|
status_path = {status}
|
||||||
foo = 1
|
foo = 1
|
||||||
|
|
||||||
[pair bob]
|
[pair bob]
|
||||||
|
|
@ -28,7 +30,7 @@ def test_load_config(tmpdir, monkeypatch):
|
||||||
|
|
||||||
[storage bob_a]
|
[storage bob_a]
|
||||||
type = filesystem
|
type = filesystem
|
||||||
path = ~/.contacts/
|
path = {contacts}
|
||||||
fileext = .vcf
|
fileext = .vcf
|
||||||
yesno = off
|
yesno = off
|
||||||
number = 42
|
number = 42
|
||||||
|
|
@ -38,16 +40,16 @@ def test_load_config(tmpdir, monkeypatch):
|
||||||
|
|
||||||
[bogus]
|
[bogus]
|
||||||
lol = true
|
lol = true
|
||||||
''').strip())
|
''').strip().format(status=status_path, contacts=contacts_path))
|
||||||
|
|
||||||
fname = str(tmpdir) + '/test.cfg'
|
fname = str(tmpdir) + '/test.cfg'
|
||||||
errors = []
|
errors = []
|
||||||
monkeypatch.setattr('vdirsyncer.cli.cli_logger.error', errors.append)
|
monkeypatch.setattr('vdirsyncer.cli.cli_logger.error', errors.append)
|
||||||
general, pairs, storages = cli.load_config(fname, pair_options=('bam',))
|
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 pairs == {'bob': ('bob_a', 'bob_b', {'bam': True}, {'foo': 'bar'})}
|
||||||
assert storages == {
|
assert storages == {
|
||||||
'bob_a': {'type': 'filesystem', 'path': '~/.contacts/',
|
'bob_a': {'type': 'filesystem', 'path': contacts_path,
|
||||||
'fileext': '.vcf', 'yesno': False, 'number': 42},
|
'fileext': '.vcf', 'yesno': False, 'number': 42},
|
||||||
'bob_b': {'type': 'carddav'}
|
'bob_b': {'type': 'carddav'}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue