diff options
author | 2017-08-23 15:54:45 +0800 | |
---|---|---|
committer | 2017-08-25 13:55:38 +0800 | |
commit | 30d7e5ef5091144ea22185bb27c7e3900d7b6a45 (patch) | |
tree | 202fb7f0e7e868b913a645ba3441f40a7e648ec0 /utils/test/testapi/opnfv_testapi/resources | |
parent | 858f34a8a3bd8949260dc37f87d13864617ad944 (diff) |
update scenario name
url PUT /api/v1/scenarios/<scenario_name>
if new_name already exist, return Forbidden
if new_name == name, return Forbidden
Change-Id: If3b82b3df4a763d60dad110caca2659c5f39ab50
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/resources')
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py | 15 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/scenario_models.py | 6 |
2 files changed, 20 insertions, 1 deletions
diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py index 6cdf99ea0..e9c19a7a4 100644 --- a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py @@ -114,8 +114,21 @@ class ScenarioGURHandler(GenericScenarioHandler): self._get_one(query={'name': name}) pass + @swagger.operation(nickname="updateScenarioName") def put(self, name): - pass + """ + @description: update scenario, only rename is supported currently + @param body: fields to be updated + @type body: L{ScenarioUpdateRequest} + @in body: body + @rtype: L{Scenario} + @return 200: update success + @raise 404: scenario not exist + @raise 403: nothing to update + """ + query = {'name': name} + db_keys = ['name'] + self._update(query=query, db_keys=db_keys) @swagger.operation(nickname="deleteScenarioByName") def delete(self, name): diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_models.py b/utils/test/testapi/opnfv_testapi/resources/scenario_models.py index c6da76b81..d950ed1d7 100644 --- a/utils/test/testapi/opnfv_testapi/resources/scenario_models.py +++ b/utils/test/testapi/opnfv_testapi/resources/scenario_models.py @@ -167,6 +167,12 @@ class ScenarioChangeOwnerRequest(models.ModelBase): @swagger.model() +class ScenarioUpdateRequest(models.ModelBase): + def __init__(self, name=None): + self.name = name + + +@swagger.model() class Scenario(models.ModelBase): """ @property installers: |