Merge pull request #64 from wheresmyjetpack/master
Testing enhancements
This commit is contained in:
commit
4df5769a1e
23
buku
23
buku
@ -446,21 +446,6 @@ class BukuDb:
|
|||||||
:tag_manual: string of comma-separated tags to add manually
|
:tag_manual: string of comma-separated tags to add manually
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.select_tags_from_bookmarks(index)
|
|
||||||
resultset = self.cur.fetchall()
|
|
||||||
for row in resultset:
|
|
||||||
tags = '%s%s' % (row[1], tag_manual[1:])
|
|
||||||
tags = parse_tags([tags])
|
|
||||||
self.cur.execute('UPDATE bookmarks SET tags = ? WHERE id = ?', (tags, row[0],))
|
|
||||||
|
|
||||||
self.conn.commit()
|
|
||||||
|
|
||||||
def select_tags_from_bookmarks(self, index):
|
|
||||||
""" Select either the tags for one bookmark or all bookmarks
|
|
||||||
|
|
||||||
:param index: int position of record, 0 for all
|
|
||||||
"""
|
|
||||||
|
|
||||||
if index == 0:
|
if index == 0:
|
||||||
resp = input('Tags will be appended for ALL bookmarks. Enter \x1b[1my\x1b[21m to confirm: ')
|
resp = input('Tags will be appended for ALL bookmarks. Enter \x1b[1my\x1b[21m to confirm: ')
|
||||||
if resp != 'y':
|
if resp != 'y':
|
||||||
@ -470,6 +455,14 @@ class BukuDb:
|
|||||||
else:
|
else:
|
||||||
self.cur.execute('SELECT id, tags FROM bookmarks WHERE id = ?', (index,))
|
self.cur.execute('SELECT id, tags FROM bookmarks WHERE id = ?', (index,))
|
||||||
|
|
||||||
|
resultset = self.cur.fetchall()
|
||||||
|
for row in resultset:
|
||||||
|
tags = '%s%s' % (row[1], tag_manual[1:])
|
||||||
|
tags = parse_tags([tags])
|
||||||
|
self.cur.execute('UPDATE bookmarks SET tags = ? WHERE id = ?', (tags, row[0],))
|
||||||
|
|
||||||
|
self.conn.commit()
|
||||||
|
|
||||||
def delete_tag_at_index(self, index, tag_manual):
|
def delete_tag_at_index(self, index, tag_manual):
|
||||||
""" Delete tags for bookmark at index
|
""" Delete tags for bookmark at index
|
||||||
|
|
||||||
|
@ -265,9 +265,12 @@ class TestBukuDb(unittest.TestCase):
|
|||||||
# deleting all bookmarks
|
# deleting all bookmarks
|
||||||
self.bdb.delete_all_bookmarks()
|
self.bdb.delete_all_bookmarks()
|
||||||
# assert table has been dropped
|
# assert table has been dropped
|
||||||
with self.assertRaises(sqlite3.OperationalError):
|
with self.assertRaises(sqlite3.OperationalError) as ctx_man:
|
||||||
self.bdb.get_bookmark_by_index(0)
|
self.bdb.get_bookmark_by_index(0)
|
||||||
|
|
||||||
|
err_msg = str(ctx_man.exception)
|
||||||
|
self.assertEqual(err_msg, 'no such table: bookmarks')
|
||||||
|
|
||||||
# @unittest.skip('skipping')
|
# @unittest.skip('skipping')
|
||||||
def test_replace_tag(self):
|
def test_replace_tag(self):
|
||||||
indices = []
|
indices = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user