Skip to content
Snippets Groups Projects
Commit 1dd00dc0 authored by Erwan Rouchet's avatar Erwan Rouchet
Browse files

Add unit test

parent 94ead709
No related branches found
No related tags found
1 merge request!91Remove all paths on Element deletion
......@@ -267,3 +267,53 @@ class TestEditElementPath(FixtureTestCase):
self.check_parents(elements, 'D', ['B'])
self.check_parents(elements, 'E', ['B'])
self.check_parents(elements, 'F', ['B', 'E'])
def test_delete_element(self):
"""
Test the signal works properly and is able to remove all paths when removing an Element.
X Y
\ /
A
/ \
[B] C
/ \
D E
\
F
"""
elements = self.build_tree({
'A': ['X', 'Y'],
'B': 'A',
'C': 'A',
'D': 'B',
'E': 'B',
'F': 'E',
})
self.check_parents(elements, 'X')
self.check_parents(elements, 'Y')
self.check_parents(elements, 'A', ['X'],
['Y'])
self.check_parents(elements, 'B', ['X', 'A'],
['Y', 'A'])
self.check_parents(elements, 'C', ['X', 'A'],
['Y', 'A'])
self.check_parents(elements, 'D', ['X', 'A', 'B'],
['Y', 'A', 'B'])
self.check_parents(elements, 'E', ['X', 'A', 'B'],
['Y', 'A', 'B'])
self.check_parents(elements, 'F', ['X', 'A', 'B', 'E'],
['Y', 'A', 'B', 'E'])
elements['B'].delete()
self.check_parents(elements, 'X')
self.check_parents(elements, 'Y')
self.check_parents(elements, 'A', ['X'],
['Y'])
self.check_parents(elements, 'C', ['X', 'A'],
['Y', 'A'])
self.check_parents(elements, 'D')
self.check_parents(elements, 'E')
self.check_parents(elements, 'F', ['E'])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment