Merge "Sort keys when dumping json"
authorvalentin boucher <valentin.boucher@orange.com>
Mon, 22 May 2017 13:09:56 +0000 (13:09 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Mon, 22 May 2017 13:09:56 +0000 (13:09 +0000)
functest/tests/unit/utils/test_decorators.py
functest/utils/functest_utils.py

index 6bd47d2..44448f2 100644 (file)
@@ -63,7 +63,7 @@ class DecoratorsTesting(unittest.TestCase):
                 'pod_name': self._node_name, 'installer': self._installer_type,
                 'scenario': self._deploy_scenario, 'version': VERSION,
                 'details': {}, 'criteria': self._result}
-        return json.dumps(data)
+        return json.dumps(data, sort_keys=True)
 
     @mock.patch('{}.get_db_url'.format(functest_utils.__name__),
                 return_value='http://127.0.0.1')
index 284c797..dc20eea 100644 (file)
@@ -221,7 +221,8 @@ def push_results_to_db(project, case_name,
     error = None
     headers = {'Content-Type': 'application/json'}
     try:
-        r = requests.post(url, data=json.dumps(params), headers=headers)
+        r = requests.post(url, data=json.dumps(params, sort_keys=True),
+                          headers=headers)
         logger.debug(r)
         r.raise_for_status()
     except requests.RequestException as exc: