mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
More tests
This commit is contained in:
parent
28b649dec9
commit
289ac2cfac
2 changed files with 24 additions and 7 deletions
|
|
@ -149,14 +149,15 @@ def test_simple_run(tmpdir):
|
|||
fileext = .txt
|
||||
''').format(str(tmpdir)))
|
||||
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(
|
||||
cli.app, ['sync'],
|
||||
env={'VDIRSYNCER_CONFIG': str(config_file)}
|
||||
)
|
||||
runner = CliRunner(env={'VDIRSYNCER_CONFIG': str(config_file)})
|
||||
result = runner.invoke(cli.app, ['sync'])
|
||||
assert not result.exception
|
||||
assert result.output.lower().strip() == 'syncing my_pair'
|
||||
|
||||
tmpdir.join('path_a/haha.txt').write('UID:haha')
|
||||
result = runner.invoke(cli.app, ['sync'])
|
||||
assert tmpdir.join('path_b/haha.txt').read() == 'UID:haha'
|
||||
|
||||
|
||||
def test_missing_general_section(tmpdir):
|
||||
config_file = tmpdir.join('config')
|
||||
|
|
@ -183,3 +184,19 @@ def test_missing_general_section(tmpdir):
|
|||
)
|
||||
assert result.exception
|
||||
assert 'critical: unable to find general section' in result.output.lower()
|
||||
|
||||
|
||||
def test_verbosity(tmpdir):
|
||||
runner = CliRunner()
|
||||
config_file = tmpdir.join('config')
|
||||
config_file.write(dedent('''
|
||||
[general]
|
||||
status_path = {0}/status/
|
||||
''').format(str(tmpdir)))
|
||||
|
||||
result = runner.invoke(
|
||||
cli.app, ['--verbosity=HAHA', 'sync'],
|
||||
env={'VDIRSYNCER_CONFIG': str(config_file)}
|
||||
)
|
||||
assert result.exception
|
||||
assert 'invalid verbosity value'
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import sys
|
|||
PY2 = sys.version_info[0] == 2
|
||||
|
||||
|
||||
if PY2:
|
||||
if PY2: # pragma: no cover
|
||||
import urlparse
|
||||
from urllib import \
|
||||
quote_plus as urlquote_plus, \
|
||||
|
|
@ -20,7 +20,7 @@ if PY2:
|
|||
text_type = unicode # flake8: noqa
|
||||
iteritems = lambda x: x.iteritems()
|
||||
itervalues = lambda x: x.itervalues()
|
||||
else:
|
||||
else: # pragma: no cover
|
||||
import urllib.parse as urlparse
|
||||
urlquote_plus = urlparse.quote_plus
|
||||
urlunquote_plus = urlparse.unquote_plus
|
||||
|
|
|
|||
Loading…
Reference in a new issue