diff options
author | Serena Feng <feng.xiaowei@zte.com.cn> | 2017-08-22 01:42:46 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-08-22 01:42:46 +0000 |
commit | 2125937047aac348645e5083654434af8d134ca4 (patch) | |
tree | f2da3f1c0221d6dabf4c1e3c74f94fa00d53cbcb /testapi/opnfv_testapi/resources/scenario_handlers.py | |
parent | 25cc46e2b60315ff7fcd21f057c55341e498098a (diff) | |
parent | eccc03242b495920115846e0add3e5e48a50a027 (diff) |
Merge "change scenario owner"
Diffstat (limited to 'testapi/opnfv_testapi/resources/scenario_handlers.py')
-rw-r--r-- | testapi/opnfv_testapi/resources/scenario_handlers.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/testapi/opnfv_testapi/resources/scenario_handlers.py b/testapi/opnfv_testapi/resources/scenario_handlers.py index 09cce7b..bd06400 100644 --- a/testapi/opnfv_testapi/resources/scenario_handlers.py +++ b/testapi/opnfv_testapi/resources/scenario_handlers.py @@ -146,6 +146,7 @@ class ScenarioUpdater(object): ('projects', 'post'): self._update_requests_add_projects, ('projects', 'put'): self._update_requests_update_projects, ('projects', 'delete'): self._update_requests_delete_projects, + ('owner', 'put'): self._update_requests_change_owner, } updates[(item, action)](self.data) @@ -251,6 +252,11 @@ class ScenarioUpdater(object): def _update_requests_delete_projects(self, version): version.projects = self._remove_projects(version.projects) + @iter_installers + @iter_versions + def _update_requests_change_owner(self, version): + version.owner = self.body + def _filter_installers(self, installers): return self._filter('installer', installers) @@ -566,3 +572,33 @@ class ScenarioProjectsHandler(GenericScenarioUpdateHandler): locators={'scenario': scenario, 'installer': None, 'version': None}) + + +class ScenarioOwnerHandler(GenericScenarioUpdateHandler): + @swagger.operation(nickname="changeScenarioOwner") + def put(self, scenario): + """ + @description: change scenario owner + @notes: substitute all projects, delete existed ones with new provides + PUT /api/v1/scenarios/<scenario_name>/owner? \ + installer=<installer_name>& \ + version=<version_name> + @param body: new owner + @type body: L{string} + @in body: body + @param installer: installer type + @type installer: L{string} + @in installer: query + @required installer: True + @param version: version + @type version: L{string} + @in version: query + @required version: True + @return 200: change owner success. + @raise 404: scenario/installer/version not existed + """ + self.do_update('owner', + 'put', + locators={'scenario': scenario, + 'installer': None, + 'version': None}) |