Skip to content
Snippets Groups Projects
Commit b91ab1c6 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

TST: add unittest for create_entity_summary

parent f71d820e
No related branches found
No related tags found
2 merge requests!105REL: v0.4.0,!102MAINT: add logging on inserts and updates
......@@ -1058,7 +1058,7 @@ class Crawler(object):
for el in entities:
for pp in el.parents:
if pp.name not in parents:
parents[pp.name] = []
parents[pp.name] = [el]
else:
parents[pp.name].append(el)
output = ""
......
......@@ -967,3 +967,20 @@ def test_split_restricted_path():
assert ["el"] == split_restricted_path("/el")
assert ["el"] == split_restricted_path("/el/")
assert ["el", "el"] == split_restricted_path("/el/el")
def test_create_entity_summary():
assert "" == Crawler.create_entity_summary([]).strip()
entities = [
db.Record(id=1).add_parent("A"),
db.Record(id=4, name='a').add_parent("B"),
db.Record(id=5).add_parent("A"),
db.Record(id=6, name='b').add_parent("B"),
]
text = Crawler.create_entity_summary(entities).strip()
assert 'a' in text
assert 'b' in text
assert 'A:' in text
assert 'B:' in text
assert "<a href='/Entity/4'>a</a>, <a href='/Entity/6'>b</a>" in text
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment