Skip to content

Commit

Permalink
Move error tests from test_common to test_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rbares committed Oct 28, 2018
1 parent f5ff086 commit 555c4ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
13 changes: 0 additions & 13 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ def test_password():

filename = os.path.join(testdir, "health_protected.pdf")

try:
tables = camelot.read_pdf(filename, flavor="stream")
assert false
except Exception as err:
assert "file has not been decrypted" in str(err)

try:
tables = camelot.read_pdf(filename, flavor="stream",
password="wrongpass")
assert false
except Exception as err:
assert "file has not been decrypted" in str(err)

tables = camelot.read_pdf(filename, flavor="stream",
password="ownerpass")
assert df.equals(tables[0].df)
Expand Down
14 changes: 14 additions & 0 deletions tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,17 @@ def _find_executable_patch(arg):
filename = os.path.join(testdir, 'foo.pdf')
with pytest.raises(Exception, message=message):
tables = camelot.read_pdf(filename)


def test_no_password():
filename = os.path.join(testdir, 'health_protected.pdf')
message = 'file has not been decrypted'
with pytest.raises(Exception, message=message):
tables = camelot.read_pdf(filename)


def test_bad_password():
filename = os.path.join(testdir, 'health_protected.pdf')
message = 'file has not been decrypted'
with pytest.raises(Exception, message=message):
tables = camelot.read_pdf(filename, password='wrongpass')

0 comments on commit 555c4ae

Please sign in to comment.