fixing test_print_bookmark

This commit is contained in:
poikjhn 2016-06-30 23:53:04 +02:00
parent 29b8cf5b6e
commit 58fc2fd5e9
2 changed files with 7 additions and 4 deletions

View File

@ -4,7 +4,7 @@ python:
- "3.4"
- "3.5"
before_install:
- pip install pytest pytest-cov
- pip install pytest pytest-cov pytest-catchlog
install: "pip install -r requirements.txt"
addons:
apt:

View File

@ -234,14 +234,17 @@ class TestBukuDb(unittest.TestCase):
# def test_import_bookmark(self):
# self.fail()
def test_print_bookmark(capsys, setup):
def test_print_bookmark(capsys, caplog, setup):
bdb = BukuDb()
out, err = capsys.readouterr()
# calling with nonexistent index
bdb.print_bookmark(1)
out, err = capsys.readouterr()
#assert out == "[ERROR] No matching index"
assert err == ''
for record in caplog.records:
assert record.levelname == "ERROR"
assert record.getMessage() == "No matching index"
assert (out, err) == ('', '')
# adding bookmarks
bdb.add_bookmark("http://full-bookmark.com", "full", parse_tags(['full,bookmark']), "full bookmark")