Skip to content

Commit

Permalink
add tests for UsageError
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavmule committed Oct 4, 2018
1 parent 17d1b30 commit 58187a7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import os

from click import UsageError
from click.testing import CliRunner
import pytest

from camelot.cli import cli
from camelot.utils import TemporaryDirectory
Expand All @@ -22,6 +24,12 @@ def test_cli_lattice():
assert result.exit_code == 0
assert result.output == 'Found 1 tables\n'

result = runner.invoke(cli, ['--format', 'csv', 'lattice', infile])
assert 'Error: Please specify output file path using --output' in result.output

result = runner.invoke(cli, ['--output', outfile, 'lattice', infile])
assert 'Please specify output file format using --format' in result.output


def test_cli_stream():
with TemporaryDirectory() as tempdir:
Expand All @@ -31,4 +39,10 @@ def test_cli_stream():
result = runner.invoke(cli, ['--format', 'csv', '--output', outfile,
'stream', infile])
assert result.exit_code == 0
assert result.output == 'Found 1 tables\n'
assert result.output == 'Found 1 tables\n'

result = runner.invoke(cli, ['--format', 'csv', 'stream', infile])
assert 'Error: Please specify output file path using --output' in result.output

result = runner.invoke(cli, ['--output', outfile, 'stream', infile])
assert 'Please specify output file format using --format' in result.output

0 comments on commit 58187a7

Please sign in to comment.