diff options
| author | jc0b <j@jc0b.computer> | 2020-06-30 19:15:26 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:44:39 +0200 |
| commit | 6345841e9e53cb1543bd85577acf0c814a2b607e (patch) | |
| tree | b98fce98224a72121f4c898b96399928dc75e348 /web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py | |
| parent | f70700b93cb8119e6537fd550fbe36c9f5a95389 (diff) | |
POST tests for topologies
Diffstat (limited to 'web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py')
| -rw-r--r-- | web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py | 8 |
1 files changed, 7 insertions, 1 deletions
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() |
