From 1fdb7e6d1cf0709b1079b2d9990c0d53d8740461 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Fri, 4 Jun 2021 12:46:15 +0200 Subject: #915 Add commands and procedures to procedure creation Adds the possibility to create a procedure with commands and other procedures integrated as steps. Note: "steps" parameter is optional and "steps" array object order defines execution order. Request: POST /procedure/add { "center": "1", "name": "procedure", "description": "My procedure", "steps": [ { "command": "wol", "params": { "type": "broadcast" } }, { "procedure": 22 }, { "command": "poweroff", "params": {} } ] } Response: 200 OK This commit also updates unit tests for /procedure/add POST method to include steps. --- tests/units/test_0033_post_procedure_add.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/units/test_0033_post_procedure_add.py b/tests/units/test_0033_post_procedure_add.py index b31ac70..89a21c7 100644 --- a/tests/units/test_0033_post_procedure_add.py +++ b/tests/units/test_0033_post_procedure_add.py @@ -8,7 +8,10 @@ class TestPostProcedureAddMethods(unittest.TestCase): self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'} self.full_json = { "center": "1", "name": "procedure1", - "description": "procedure test" } + "description": "procedure test", + "steps": [ { "command": "wol", + "params": { "type": "broadcast" } }, + { "procedure": 22 } ] } self.minimal_json = { "center": "1", "name": "procedure2" } self.duplicated_procedure_json = { "center": "1", -- cgit v1.2.3-18-g5258