From 6345841e9e53cb1543bd85577acf0c814a2b607e Mon Sep 17 00:00:00 2001 From: jc0b Date: Tue, 30 Jun 2020 19:15:26 +0200 Subject: POST tests for topologies --- .../opendc/api/v2/simulations/simulationId/topologies/endpoint.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py') diff --git a/web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py b/web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py index 952959ca..ecf80353 100644 --- a/web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py +++ b/web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py @@ -9,7 +9,12 @@ from opendc.util.database import Database def POST(request): """Add a new Topology to the specified simulation and return it""" - request.check_required_parameters(path={'simulationId': 'string'}, body={'topology': {'name': 'string'}}) + request.check_required_parameters(path={'simulationId': 'string'}, + body={ + 'topology': { + 'name': 'string' + } + }) simulation = Simulation.from_id(request.params_path['simulationId']) @@ -17,6 +22,7 @@ def POST(request): simulation.check_user_access(request.google_id, True) topology = Topology({'name': request.params_body['topology']['name']}) + topology.set_property('datetimeCreated', Database.datetime_to_string(datetime.now())) topology.set_property('datetimeLastEdited', Database.datetime_to_string(datetime.now())) topology.insert() -- cgit v1.2.3