mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
add testcase for #192
This commit is contained in:
parent
858fda7765
commit
53414f5bee
1 changed files with 31 additions and 2 deletions
|
|
@ -2,10 +2,11 @@
|
||||||
|
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
from click.testing import CliRunner
|
|
||||||
|
|
||||||
import vdirsyncer.cli as cli
|
import vdirsyncer.cli as cli
|
||||||
|
|
||||||
|
from click.testing import CliRunner
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
def test_simple_run(tmpdir, runner):
|
def test_simple_run(tmpdir, runner):
|
||||||
runner.write_with_general(dedent('''
|
runner.write_with_general(dedent('''
|
||||||
|
|
@ -291,3 +292,31 @@ def test_ident_conflict(tmpdir, runner):
|
||||||
'two.txt' in result.output,
|
'two.txt' in result.output,
|
||||||
'three.txt' in result.output,
|
'three.txt' in result.output,
|
||||||
]) == [False, True, True]
|
]) == [False, True, True]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('existing,missing', [
|
||||||
|
('foo', 'bar'),
|
||||||
|
('bar', 'foo'),
|
||||||
|
])
|
||||||
|
def test_unknown_storage(tmpdir, runner, existing, missing):
|
||||||
|
runner.write_with_general(dedent('''
|
||||||
|
[pair foobar]
|
||||||
|
a = foo
|
||||||
|
b = bar
|
||||||
|
|
||||||
|
[storage {existing}]
|
||||||
|
type = filesystem
|
||||||
|
path = {base}/{existing}/
|
||||||
|
fileext = .txt
|
||||||
|
'''.format(base=str(tmpdir), existing=existing)))
|
||||||
|
|
||||||
|
tmpdir.mkdir(existing)
|
||||||
|
|
||||||
|
result = runner.invoke(['sync'])
|
||||||
|
assert result.exception
|
||||||
|
|
||||||
|
assert (
|
||||||
|
"Storage '{missing}' not found. "
|
||||||
|
"These are the configured storages: ['{existing}']"
|
||||||
|
.format(missing=missing, existing=existing)
|
||||||
|
) in result.output
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue