summaryrefslogtreecommitdiffstats
path: root/utils/test
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2017-05-19 15:18:34 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2017-05-19 15:18:34 +0800
commit1261ce7747b463a0f70d228567be4829d43d148f (patch)
treed6e26deedecd3b0d3217207ec7742d89104ab05c /utils/test
parent076e3ee6a990acc801554edfc63798dc42c32707 (diff)
bugfix: extra fields are added when push results
extra fields like 'carriers' & 'miss_checks' 'db_key' are added when pushing result to TestDB Change-Id: Ic8d0751bca14b3b3260df42c0f4f07456c9d5e05 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test')
-rw-r--r--utils/test/testapi/opnfv_testapi/common/check.py6
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/handlers.py3
2 files changed, 5 insertions, 4 deletions
diff --git a/utils/test/testapi/opnfv_testapi/common/check.py b/utils/test/testapi/opnfv_testapi/common/check.py
index 4d9902cd0..67e8fbd40 100644
--- a/utils/test/testapi/opnfv_testapi/common/check.py
+++ b/utils/test/testapi/opnfv_testapi/common/check.py
@@ -61,7 +61,7 @@ def no_body(xstep):
def miss_fields(xstep):
@functools.wraps(xstep)
def wrap(self, *args, **kwargs):
- fields = kwargs.get('miss_fields')
+ fields = kwargs.pop('miss_fields', [])
if fields:
for miss in fields:
miss_data = self.json_args.get(miss)
@@ -75,7 +75,7 @@ def miss_fields(xstep):
def carriers_exist(xstep):
@functools.wraps(xstep)
def wrap(self, *args, **kwargs):
- carriers = kwargs.get('carriers')
+ carriers = kwargs.pop('carriers', {})
if carriers:
for table, query in carriers:
exist = yield self._eval_db_find_one(query(), table)
@@ -102,7 +102,7 @@ def new_not_exists(xstep):
def updated_one_not_exist(xstep):
@functools.wraps(xstep)
def wrap(self, data, *args, **kwargs):
- db_keys = kwargs.get('db_keys')
+ db_keys = kwargs.pop('db_keys', [])
query = self._update_query(db_keys, data)
if query:
to_data = yield self._eval_db_find_one(query)
diff --git a/utils/test/testapi/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/resources/handlers.py
index 2426805b6..2fc31ca45 100644
--- a/utils/test/testapi/opnfv_testapi/resources/handlers.py
+++ b/utils/test/testapi/opnfv_testapi/resources/handlers.py
@@ -85,7 +85,8 @@ class GenericApiHandler(web.RequestHandler):
"""
data = self.table_cls.from_dict(self.json_args)
for k, v in kwargs.iteritems():
- data.__setattr__(k, v)
+ if k != 'query':
+ data.__setattr__(k, v)
if self.table != 'results':
data.creation_date = datetime.now()