Test pump cascade deletion
This commit is contained in:
@@ -1296,6 +1296,51 @@ class TestApi:
|
||||
self.leave(p)
|
||||
|
||||
|
||||
def test_pipe_del(self):
|
||||
p = 'test_pipe_del'
|
||||
self.enter(p)
|
||||
|
||||
add_junction(p, ChangeSet({'id': 'j0', 'x': 0.0, 'y': 10.0, 'elevation': 20.0}))
|
||||
add_junction(p, ChangeSet({'id': 'j1', 'x': 0.0, 'y': 10.0, 'elevation': 20.0}))
|
||||
add_pump(p, ChangeSet({'id': 'p0', 'node1': 'j0', 'node2': 'j1', 'power': 0.0}))
|
||||
set_tag(p, ChangeSet({'t_type': TAG_TYPE_LINK, 'id': 'p0', 'tag': 'p0t' }))
|
||||
set_status(p, ChangeSet({'link': 'p0', 'status': LINK_STATUS_OPEN, 'setting': 10.0}))
|
||||
set_pump_energy(p, ChangeSet({'pump' : 'p0', 'price': 1.0}))
|
||||
set_vertex(p, ChangeSet({'link' : 'p0', 'coords': [{'x': 1.0, 'y': 2.0}, {'x': 2.0, 'y': 1.0}]}))
|
||||
assert is_pump(p, 'p0')
|
||||
assert get_tag(p, TAG_TYPE_LINK, 'p0')['tag'] == 'p0t'
|
||||
assert get_status(p, 'p0')['status'] == LINK_STATUS_OPEN
|
||||
assert get_status(p, 'p0')['setting'] == 10.0
|
||||
assert get_pump_energy(p, 'p0')['price'] == 1.0
|
||||
assert get_vertex(p, 'p0')['coords'] == [{'x': 1.0, 'y': 2.0}, {'x': 2.0, 'y': 1.0}]
|
||||
|
||||
delete_pump(p, ChangeSet({'id': 'p0'}))
|
||||
assert is_pump(p, 'p0') == False
|
||||
assert get_tag(p, TAG_TYPE_LINK, 'p0')['tag'] == None
|
||||
assert get_status(p, 'p0')['status'] == None
|
||||
assert get_status(p, 'p0')['setting'] == None
|
||||
assert get_pump_energy(p, 'p0')['price'] == None
|
||||
assert get_vertex(p, 'p0')['coords'] == []
|
||||
|
||||
execute_undo(p)
|
||||
assert is_pump(p, 'p0')
|
||||
assert get_tag(p, TAG_TYPE_LINK, 'p0')['tag'] == 'p0t'
|
||||
assert get_status(p, 'p0')['status'] == LINK_STATUS_OPEN
|
||||
assert get_status(p, 'p0')['setting'] == 10.0
|
||||
assert get_pump_energy(p, 'p0')['price'] == 1.0
|
||||
assert get_vertex(p, 'p0')['coords'] == [{'x': 1.0, 'y': 2.0}, {'x': 2.0, 'y': 1.0}]
|
||||
|
||||
execute_redo(p)
|
||||
assert is_pump(p, 'p0') == False
|
||||
assert get_tag(p, TAG_TYPE_LINK, 'p0')['tag'] == None
|
||||
assert get_status(p, 'p0')['status'] == None
|
||||
assert get_status(p, 'p0')['setting'] == None
|
||||
assert get_pump_energy(p, 'p0')['price'] == None
|
||||
assert get_vertex(p, 'p0')['coords'] == []
|
||||
|
||||
self.leave(p)
|
||||
|
||||
|
||||
# 7 valve
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user