Remove the former results in DB url 01/34501/2
authorCédric Ollivier <cedric.ollivier@orange.com>
Tue, 9 May 2017 14:59:49 +0000 (16:59 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Tue, 9 May 2017 15:11:40 +0000 (17:11 +0200)
It conforms generate_report.py with the previous change [1].

[1] https://gerrit.opnfv.org/gerrit/#/c/33511/

Change-Id: I677ebd416f462a591439fc7b637c02d7964e6173
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
functest/ci/generate_report.py
functest/tests/unit/ci/test_generate_report.py

index 17240e8..e400b1b 100644 (file)
@@ -39,8 +39,8 @@ def init(tiers_to_run=[]):
 
 
 def get_results_from_db():
-    url = "%s/results?build_tag=%s" % (ft_utils.get_db_url(),
-                                       CONST.BUILD_TAG)
+    url = "%s?build_tag=%s" % (ft_utils.get_db_url(),
+                               CONST.BUILD_TAG)
     logger.debug("Query to rest api: %s" % url)
     try:
         data = json.load(urllib2.urlopen(url))
@@ -56,7 +56,7 @@ def get_data(test, results):
     for test_db in results:
         if test['test_name'] in test_db['case_name']:
             id = test_db['_id']
-            url = ft_utils.get_db_url() + '/results/' + id
+            url = ft_utils.get_db_url() + '/' + id
             test_result = test_db['criteria']
 
     return {"url": url, "result": test_result}
index 13361c1..2c5ce2e 100644 (file)
@@ -28,16 +28,16 @@ class GenerateReportTesting(unittest.TestCase):
     @mock.patch('functest.ci.generate_report.urllib2.urlopen',
                 side_effect=urllib2.URLError('no host given'))
     def test_get_results_from_db_fail(self, mock_method):
-        url = "%s/results?build_tag=%s" % (ft_utils.get_db_url(),
-                                           CONST.__getattribute__('BUILD_TAG'))
+        url = "%s?build_tag=%s" % (ft_utils.get_db_url(),
+                                   CONST.__getattribute__('BUILD_TAG'))
         self.assertIsNone(gen_report.get_results_from_db())
         mock_method.assert_called_once_with(url)
 
     @mock.patch('functest.ci.generate_report.urllib2.urlopen',
                 return_value={'results': []})
     def test_get_results_from_db_success(self, mock_method):
-        url = "%s/results?build_tag=%s" % (ft_utils.get_db_url(),
-                                           CONST.__getattribute__('BUILD_TAG'))
+        url = "%s?build_tag=%s" % (ft_utils.get_db_url(),
+                                   CONST.__getattribute__('BUILD_TAG'))
         self.assertEqual(gen_report.get_results_from_db(), None)
         mock_method.assert_called_once_with(url)