Update title and junction test
This commit is contained in:
@@ -17,7 +17,7 @@ class TestApi:
|
||||
delete_project(p)
|
||||
|
||||
def test_project(self):
|
||||
p = "test_title"
|
||||
p = "test_project"
|
||||
|
||||
assert not have_project(p)
|
||||
assert not is_project_open(p)
|
||||
@@ -66,7 +66,10 @@ class TestApi:
|
||||
|
||||
assert get_title(p) == ""
|
||||
|
||||
set_title(p, "title")
|
||||
change = set_title(p, "title").operations[0]
|
||||
assert change['operation'] == 'update'
|
||||
assert change['type'] == 'title'
|
||||
assert change['id'] == ''
|
||||
assert get_title(p) == "title"
|
||||
|
||||
set_title(p, "test")
|
||||
@@ -84,22 +87,22 @@ class TestApi:
|
||||
assert change_set.operations[0]['operation'] == 'add'
|
||||
assert change_set.operations[0]['type'] == JUNCTION
|
||||
assert change_set.operations[0]['id'] == "j0"
|
||||
coord = get_junction_properties(p, 'j0')['coord']
|
||||
coord = get_junction(p, 'j0')['coord']
|
||||
assert coord['x'] == 0.0
|
||||
assert coord['y'] == 10.0
|
||||
z = get_junction_properties(p, 'j0')['elevation']
|
||||
z = get_junction(p, 'j0')['elevation']
|
||||
assert z == 20.0
|
||||
|
||||
assert get_junction_properties(p, 'j') == None
|
||||
assert get_junction_properties(p, 'j0')['demand'] == None
|
||||
assert get_junction_properties(p, 'j0')['demand'] == None
|
||||
change_set = set_junction_demand(p, 'j0', 100.0)
|
||||
assert get_junction(p, 'j') == None
|
||||
assert get_junction(p, 'j0')['demand'] == None
|
||||
assert get_junction(p, 'j0')['demand'] == None
|
||||
change_set = set_junction(p, 'j0', {'demand': 100.0})
|
||||
assert len(change_set.operations) == 1
|
||||
assert change_set.operations[0]['operation'] == 'update'
|
||||
assert change_set.operations[0]['type'] == JUNCTION
|
||||
assert change_set.operations[0]['id'] == 'j0'
|
||||
assert change_set.operations[0]['property'] == 'demand'
|
||||
assert get_junction_properties(p, 'j0')['demand'] == 100.0
|
||||
assert 'demand' in change_set.operations[0]['properties']
|
||||
assert get_junction(p, 'j0')['demand'] == 100.0
|
||||
|
||||
# TODO: pattern
|
||||
|
||||
@@ -139,19 +142,23 @@ class TestApi:
|
||||
nodes = get_nodes(p)
|
||||
assert len(nodes) == 0
|
||||
|
||||
self.leave(p)
|
||||
|
||||
'''
|
||||
add_junction(p, 'j1', 0.0, 0.0, 0.0)
|
||||
add_junction(p, 'j2', 10.0, 10.0, 10.0)
|
||||
add_junction(p, 'j3', 10.0, 10.0, 10.0)
|
||||
add_pipe(p, 'p1', 'j1', 'j2')
|
||||
add_pump(p, 'p2', 'j1', 'j2')
|
||||
add_valve(p, 'v1', 'j2', 'j3')
|
||||
assert get_junction_properties(p, 'j1')['links'] == ['p1', 'p2']
|
||||
assert get_junction_properties(p, 'j2')['links'] == ['p1', 'p2', 'v1']
|
||||
assert get_junction_properties(p, 'j3')['links'] == ['v1']
|
||||
|
||||
self.leave(p)
|
||||
assert get_junction(p, 'j1')['links'] == ['p1', 'p2']
|
||||
assert get_junction(p, 'j2')['links'] == ['p1', 'p2', 'v1']
|
||||
assert get_junction(p, 'j3')['links'] == ['v1']
|
||||
'''
|
||||
|
||||
|
||||
|
||||
'''
|
||||
def test_reservoir(self):
|
||||
p = "test_reservoir"
|
||||
self.enter(p)
|
||||
@@ -671,6 +678,6 @@ class TestApi:
|
||||
assert change_set.operations[0]['id'] == "v2"
|
||||
|
||||
self.leave(p)
|
||||
|
||||
'''
|
||||
if __name__ == '__main__':
|
||||
pytest.main()
|
||||
|
||||
Reference in New Issue
Block a user