Skip to content

Commit

Permalink
Add CLI tests (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayak-mehta committed Oct 2, 2018
1 parent 2b8ae5f commit 2a1d21a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Binary file added tests/files/budget.pdf
Binary file not shown.
35 changes: 34 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-

import os

from click.testing import CliRunner

from camelot.cli import cli
from camelot.utils import TemporaryDirectory


testdir = os.path.dirname(os.path.abspath(__file__))
testdir = os.path.join(testdir, 'files')


def test_cli_lattice():
with TemporaryDirectory() as tempdir:
infile = os.path.join(testdir, 'foo.pdf')
outfile = os.path.join(tempdir, 'foo.csv')
runner = CliRunner()
result = runner.invoke(cli, ['--format', 'csv', '--output', outfile,
'lattice', infile])
assert result.exit_code == 0
assert result.output == 'Found 1 tables\n'


def test_cli_stream():
with TemporaryDirectory() as tempdir:
infile = os.path.join(testdir, 'budget.pdf')
outfile = os.path.join(tempdir, 'budget.csv')
runner = CliRunner()
result = runner.invoke(cli, ['--format', 'csv', '--output', outfile,
'stream', infile])
assert result.exit_code == 0
assert result.output == 'Found 1 tables\n'

0 comments on commit 2a1d21a

Please sign in to comment.