Removed horribly unmaintainable test case.
This commit is contained in:
parent
bfdfb0604b
commit
620f1944fb
@ -427,45 +427,6 @@ class TestBukuDb(unittest.TestCase):
|
||||
# self.fail()
|
||||
|
||||
|
||||
def test_print_rec(capsys, caplog, setup):
|
||||
bdb = BukuDb()
|
||||
out, err = capsys.readouterr()
|
||||
# calling with nonexistent index
|
||||
bdb.print_rec(1)
|
||||
out, err = capsys.readouterr()
|
||||
|
||||
for record in caplog.records:
|
||||
assert record.levelname == "ERROR"
|
||||
assert record.getMessage() == "No matching index 1"
|
||||
assert (out, err) == ('', '')
|
||||
|
||||
# adding bookmarks
|
||||
bdb.add_rec("http://full-bookmark.com", "full", parse_tags(['full,bookmark']), "full bookmark")
|
||||
bdb.add_rec("http://blank-title.com", "", parse_tags(['blank,title']), "blank title")
|
||||
bdb.add_rec("http://empty-tags.com", "empty tags", parse_tags(['']), "empty tags")
|
||||
bdb.add_rec("http://all-empty.com", "", parse_tags(['']), "all empty")
|
||||
out, err = capsys.readouterr()
|
||||
|
||||
# printing first bookmark
|
||||
bdb.print_rec(1)
|
||||
out, err = capsys.readouterr()
|
||||
assert out == "\x1b[93;1m1. \x1b[0;92mhttp://full-bookmark.com\x1b[0m\n \x1b[91m>\x1b[0m full\n \x1b[91m+\x1b[0m full bookmark\n \x1b[91m#\x1b[0m bookmark,full\n\n"
|
||||
assert err == ''
|
||||
|
||||
# printing all bookmarks
|
||||
bdb.print_rec(0)
|
||||
out, err = capsys.readouterr()
|
||||
assert out == "\x1b[93;1m1. \x1b[0;92mhttp://full-bookmark.com\x1b[0m\n \x1b[91m>\x1b[0m full\n \x1b[91m+\x1b[0m full bookmark\n \x1b[91m#\x1b[0m bookmark,full\n\n\x1b[93;1m2. \x1b[0;92mhttp://blank-title.com\x1b[0m\n \x1b[91m+\x1b[0m blank title\n \x1b[91m#\x1b[0m blank,title\n\n\x1b[93;1m3. \x1b[0;92mhttp://empty-tags.com\x1b[0m\n \x1b[91m>\x1b[0m empty tags\n \x1b[91m+\x1b[0m empty tags\n\n\x1b[93;1m4. \x1b[0;92mhttp://all-empty.com\x1b[0m\n \x1b[91m+\x1b[0m all empty\n\n"
|
||||
assert err == ''
|
||||
|
||||
# printing all bookmarks with empty fields
|
||||
results = bdb.searchdb(['blank'], True)
|
||||
prompt(bdb, results, True)
|
||||
out, err = capsys.readouterr()
|
||||
assert out == "\x1b[93;1m1. \x1b[0;92mhttp://blank-title.com\x1b[0;1m [2]\x1b[0m\n \x1b[91m+\x1b[0m blank title\n \x1b[91m#\x1b[0m blank,title\n\n\x1b[93;1m2. \x1b[0;92mhttp://empty-tags.com\x1b[0;1m [3]\x1b[0m\n \x1b[91m>\x1b[0m empty tags\n \x1b[91m+\x1b[0m empty tags\n\n\x1b[93;1m3. \x1b[0;92mhttp://all-empty.com\x1b[0;1m [4]\x1b[0m\n \x1b[91m+\x1b[0m all empty\n\n"
|
||||
assert err == ''
|
||||
|
||||
|
||||
@given(
|
||||
index=st.integers(min_value=-10, max_value=10),
|
||||
low=st.integers(min_value=-10, max_value=10),
|
||||
|
Loading…
x
Reference in New Issue
Block a user