aboutsummaryrefslogtreecommitdiffstats
path: root/functest/api/common/api_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'functest/api/common/api_utils.py')
-rw-r--r--functest/api/common/api_utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/functest/api/common/api_utils.py b/functest/api/common/api_utils.py
index f518e777..d85acf92 100644
--- a/functest/api/common/api_utils.py
+++ b/functest/api/common/api_utils.py
@@ -18,6 +18,7 @@ import os
import sys
from oslo_utils import importutils
+from flask import jsonify
import six
import functest
@@ -89,3 +90,12 @@ def change_obj_to_dict(obj):
for key, value in vars(obj).items():
dic.update({key: value})
return dic
+
+
+def result_handler(status, data):
+ """ Return the json format of result in dict """
+ result = {
+ 'status': status,
+ 'result': data
+ }
+ return jsonify(result)