fixing tests
This commit is contained in:
parent
08543af540
commit
3e395b00e0
@ -29,19 +29,19 @@ class TestBukuDb(unittest.TestCase):
|
||||
|
||||
self.bookmarks = [ ['http://slashdot.org',
|
||||
'SLASHDOT',
|
||||
parse_tags(['old', 'news']),
|
||||
parse_tags(['old,news']),
|
||||
"News for old nerds, stuff that doesn't matter",
|
||||
],
|
||||
|
||||
['http://www.zażółćgęśląjaźń.pl/',
|
||||
'ZAŻÓŁĆ',
|
||||
parse_tags(['zażółć', 'gęślą', 'jaźń']),
|
||||
parse_tags(['zażółć,gęślą,jaźń']),
|
||||
"Testing UTF-8, zażółć gęślą jaźń.",
|
||||
],
|
||||
|
||||
['https://test.com:8080',
|
||||
'test',
|
||||
parse_tags(['test', 'tes', 'est', 'es']),
|
||||
parse_tags(['test,tes,est,es']),
|
||||
"a case for replace_tag test",
|
||||
],
|
||||
]
|
||||
@ -133,24 +133,11 @@ class TestBukuDb(unittest.TestCase):
|
||||
# @unittest.skip('skipping')
|
||||
def test_refreshdb(self):
|
||||
bdb = BukuDb()
|
||||
indices = []
|
||||
for bookmark in self.bookmarks:
|
||||
# adding bookmark, getting index
|
||||
bdb.add_bookmark(*bookmark)
|
||||
index = bdb.get_bookmark_index(bookmark[0])
|
||||
indices += [index]
|
||||
# refreshing bookmark, comparing values
|
||||
bdb.refreshdb(index, "__refresh_01")
|
||||
from_db = bdb.get_bookmark_by_index(index)
|
||||
self.assertEqual(from_db[2], "__refresh_01")
|
||||
|
||||
# refreshing all bookmarks (index 0)
|
||||
bdb.refreshdb(0, "__refresh_02")
|
||||
for index in indices:
|
||||
from_db = bdb.get_bookmark_by_index(index)
|
||||
self.assertEqual(from_db[2], "__refresh_02")
|
||||
|
||||
# TODO: test refreshdb without title_manual (url fetch)
|
||||
bdb.add_bookmark("https://www.google.com/ncr", "?")
|
||||
bdb.refreshdb(1)
|
||||
from_db = bdb.get_bookmark_by_index(1)
|
||||
self.assertEqual(from_db[2], "Google")
|
||||
|
||||
# def test_searchdb(self):
|
||||
# self.fail()
|
||||
@ -192,7 +179,7 @@ class TestBukuDb(unittest.TestCase):
|
||||
indices += [index]
|
||||
# replacing tags
|
||||
bdb.replace_tag("news", ["__01"])
|
||||
bdb.replace_tag("zażółć", ["__02", "__03"])
|
||||
bdb.replace_tag("zażółć", ["__02,__03"])
|
||||
# replacing tag which is also a substring of other tag
|
||||
bdb.replace_tag("es", ["__04"])
|
||||
# removing tags
|
||||
@ -211,9 +198,9 @@ class TestBukuDb(unittest.TestCase):
|
||||
if title == "SLASHDOT":
|
||||
self.assertEqual(from_db[3], parse_tags(["__01"]))
|
||||
elif title == "ZAŻÓŁĆ":
|
||||
self.assertEqual(from_db[3], parse_tags(["__02", "__03", "jaźń"]))
|
||||
self.assertEqual(from_db[3], parse_tags(["__02,__03,jaźń"]))
|
||||
elif title == "test":
|
||||
self.assertEqual(from_db[3], parse_tags(["test", "tes", "est", "__04"]))
|
||||
self.assertEqual(from_db[3], parse_tags(["test,tes,est,__04"]))
|
||||
|
||||
# def test_browse_by_index(self):
|
||||
# self.fail()
|
||||
|
Loading…
Reference in New Issue
Block a user