From f23e8d9b31b53869e4baa36cae61af5853b49fb2 Mon Sep 17 00:00:00 2001 From: thuva4 Date: Thu, 12 Apr 2018 10:26:06 +0530 Subject: Allow update the other field(exclude name) JIRA: RELENG-350 Change-Id: I1713985c02f59ea518058c309043f66a6bd07855 Signed-off-by: thuva4 --- testapi/opnfv_testapi/common/check.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/testapi/opnfv_testapi/common/check.py b/testapi/opnfv_testapi/common/check.py index 09a9270..fdc527f 100644 --- a/testapi/opnfv_testapi/common/check.py +++ b/testapi/opnfv_testapi/common/check.py @@ -65,12 +65,14 @@ def is_reource_tied(method): } if self.table in tied_maps: if method.__name__ == '_update': - if 'name' not in self.json_args: - ret = yield gen.coroutine(method)(self, *args, **kwargs) - raise gen.Return(ret) + if 'name' in self.json_args: + if self.json_args['name'] == kwargs.get('query')['name']: + ret = yield gen.coroutine(method)( + self, *args, **kwargs) + raise gen.Return(ret) query_data[tied_maps[self.table][1]] = kwargs.get('query')['name'] - data = yield dbapi.db_find_one(tied_maps[self.table][0], - query_data) + data = yield dbapi.db_find_one( + tied_maps[self.table][0], query_data) if data: raises.Unauthorized(message.tied_with_resource()) ret = yield gen.coroutine(method)(self, *args, **kwargs) -- cgit 1.2.3-korg