FIX(buku) ff json import folder w/o children
- fixes jarun/Buku#340 - replaced error with warning - proper warning message added - test added
This commit is contained in:
parent
f316f9b980
commit
727141b5e2
6
buku
6
buku
@ -3027,7 +3027,7 @@ def import_firefox_json(json, add_bookmark_folder_as_tag=False, unique_tag=None)
|
||||
.format(bm_entry['uri'], bm_entry['title'], tags, desc))
|
||||
yield (bm_entry['uri'], bm_entry['title'], tags, desc, 0, True, False)
|
||||
except Exception as e:
|
||||
LOGERR(e)
|
||||
LOGERR("Error parsing entry '{}' Exception '{}'".format(bm_entry['title'], e))
|
||||
|
||||
elif TypeCode.folder.value == typeCode:
|
||||
try:
|
||||
@ -3037,9 +3037,9 @@ def import_firefox_json(json, add_bookmark_folder_as_tag=False, unique_tag=None)
|
||||
for entry in iterate_children(
|
||||
parent_folder+"/"+bm_entry['title'], bm_entry['children']):
|
||||
yield entry
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
# if any of the properties does not exist, bail out silently
|
||||
LOGERR(e)
|
||||
LOGDBG("No 'children' found in bookmark folder - skipping: {}".format(bm_entry['title']))
|
||||
|
||||
elif TypeCode.separator.value == typeCode:
|
||||
LOGDBG("Unknown typeCode found : {}".format(typeCode))
|
||||
|
@ -110,6 +110,25 @@ def test_load_invalid_typecode():
|
||||
|
||||
assert len(result) == 0
|
||||
|
||||
def test_load_folder_with_no_children():
|
||||
"""test method."""
|
||||
|
||||
# Arrange
|
||||
data = json.loads("""
|
||||
{
|
||||
"title" : "title",
|
||||
"typeCode" : 2
|
||||
} """)
|
||||
|
||||
# Act
|
||||
items = import_firefox_json(data)
|
||||
|
||||
# Assert
|
||||
result = []
|
||||
for item in items:
|
||||
result.append(item)
|
||||
|
||||
assert 0 == len(result)
|
||||
|
||||
def test_load_one_child():
|
||||
"""test method."""
|
||||
|
Loading…
Reference in New Issue
Block a user