summaryrefslogtreecommitdiffstats
path: root/utils/test/result_collection_api/tests
diff options
context:
space:
mode:
Diffstat (limited to 'utils/test/result_collection_api/tests')
-rw-r--r--utils/test/result_collection_api/tests/unit/fake_pymongo.py2
-rw-r--r--utils/test/result_collection_api/tests/unit/test_base.py9
-rw-r--r--utils/test/result_collection_api/tests/unit/test_pod.py4
-rw-r--r--utils/test/result_collection_api/tests/unit/test_project.py4
-rw-r--r--utils/test/result_collection_api/tests/unit/test_result.py10
-rw-r--r--utils/test/result_collection_api/tests/unit/test_testcase.py4
6 files changed, 17 insertions, 16 deletions
diff --git a/utils/test/result_collection_api/tests/unit/fake_pymongo.py b/utils/test/result_collection_api/tests/unit/fake_pymongo.py
index 40eb164db..3494280fa 100644
--- a/utils/test/result_collection_api/tests/unit/fake_pymongo.py
+++ b/utils/test/result_collection_api/tests/unit/fake_pymongo.py
@@ -33,6 +33,8 @@ class MemDb(object):
def _find_one(self, spec_or_id=None, *args):
if spec_or_id is not None and not isinstance(spec_or_id, dict):
spec_or_id = {"_id": spec_or_id}
+ if '_id' in spec_or_id:
+ spec_or_id['_id'] = str(spec_or_id['_id'])
cursor = self._find(spec_or_id, *args)
for result in cursor:
return result
diff --git a/utils/test/result_collection_api/tests/unit/test_base.py b/utils/test/result_collection_api/tests/unit/test_base.py
index dfb2070c4..036c6cf6d 100644
--- a/utils/test/result_collection_api/tests/unit/test_base.py
+++ b/utils/test/result_collection_api/tests/unit/test_base.py
@@ -4,9 +4,9 @@ from tornado.testing import AsyncHTTPTestCase
from resources.pod_handlers import PodCLHandler, PodGURHandler
from resources.project_handlers import ProjectCLHandler, ProjectGURHandler
-from resources.handlers import VersionHandler, \
- TestResultsHandler, DashboardHandler
+from resources.handlers import VersionHandler, DashboardHandler
from resources.testcase_handlers import TestcaseCLHandler, TestcaseGURHandler
+from resources.result_handlers import ResultsCLHandler, ResultsGURHandler
from resources.models import CreateResponse
import fake_pymongo
@@ -36,9 +36,8 @@ class TestBase(AsyncHTTPTestCase):
(r"/api/v1/projects/([^/]+)/cases", TestcaseCLHandler),
(r"/api/v1/projects/([^/]+)/cases/([^/]+)",
TestcaseGURHandler),
- (r"/api/v1/results", TestResultsHandler),
- (r"/api/v1/results([^/]*)", TestResultsHandler),
- (r"/api/v1/results/([^/]*)", TestResultsHandler),
+ (r"/api/v1/results", ResultsCLHandler),
+ (r"/api/v1/results/([^/]+)", ResultsGURHandler),
(r"/dashboard/v1/results", DashboardHandler),
(r"/dashboard/v1/results([^/]*)", DashboardHandler),
],
diff --git a/utils/test/result_collection_api/tests/unit/test_pod.py b/utils/test/result_collection_api/tests/unit/test_pod.py
index 8a9302738..1a43c0563 100644
--- a/utils/test/result_collection_api/tests/unit/test_pod.py
+++ b/utils/test/result_collection_api/tests/unit/test_pod.py
@@ -36,13 +36,13 @@ class TestPodCreate(TestPodBase):
req_empty = PodCreateRequest('')
(code, body) = self.create(req_empty)
self.assertEqual(code, HTTP_BAD_REQUEST)
- self.assertIn('pod name missing', body)
+ self.assertIn('name missing', body)
def test_noneName(self):
req_none = PodCreateRequest(None)
(code, body) = self.create(req_none)
self.assertEqual(code, HTTP_BAD_REQUEST)
- self.assertIn('pod name missing', body)
+ self.assertIn('name missing', body)
def test_success(self):
code, body = self.create_d()
diff --git a/utils/test/result_collection_api/tests/unit/test_project.py b/utils/test/result_collection_api/tests/unit/test_project.py
index b07cb7ad6..4f5bd9d5e 100644
--- a/utils/test/result_collection_api/tests/unit/test_project.py
+++ b/utils/test/result_collection_api/tests/unit/test_project.py
@@ -34,13 +34,13 @@ class TestProjectCreate(TestProjectBase):
req_empty = ProjectCreateRequest('')
(code, body) = self.create(req_empty)
self.assertEqual(code, HTTP_BAD_REQUEST)
- self.assertIn('project name missing', body)
+ self.assertIn('name missing', body)
def test_noneName(self):
req_none = ProjectCreateRequest(None)
(code, body) = self.create(req_none)
self.assertEqual(code, HTTP_BAD_REQUEST)
- self.assertIn('project name missing', body)
+ self.assertIn('name missing', body)
def test_success(self):
(code, body) = self.create_d()
diff --git a/utils/test/result_collection_api/tests/unit/test_result.py b/utils/test/result_collection_api/tests/unit/test_result.py
index 7dd07efa8..5757df014 100644
--- a/utils/test/result_collection_api/tests/unit/test_result.py
+++ b/utils/test/result_collection_api/tests/unit/test_result.py
@@ -105,35 +105,35 @@ class TestResultCreate(TestResultBase):
def test_nobody(self):
(code, body) = self.create(None)
self.assertEqual(code, HTTP_BAD_REQUEST)
- self.assertIn('no payload', body)
+ self.assertIn('no body', body)
def test_podNotProvided(self):
req = self.req_d
req.pod_name = None
(code, body) = self.create(req)
self.assertEqual(code, HTTP_BAD_REQUEST)
- self.assertIn('pod is not provided', body)
+ self.assertIn('pod_name missing', body)
def test_projectNotProvided(self):
req = self.req_d
req.project_name = None
(code, body) = self.create(req)
self.assertEqual(code, HTTP_BAD_REQUEST)
- self.assertIn('project is not provided', body)
+ self.assertIn('project_name missing', body)
def test_testcaseNotProvided(self):
req = self.req_d
req.case_name = None
(code, body) = self.create(req)
self.assertEqual(code, HTTP_BAD_REQUEST)
- self.assertIn('testcase is not provided', body)
+ self.assertIn('case_name missing', body)
def test_noPod(self):
req = self.req_d
req.pod_name = 'notExistPod'
(code, body) = self.create(req)
self.assertEqual(code, HTTP_NOT_FOUND)
- self.assertIn('Could not find POD', body)
+ self.assertIn('Could not find pod', body)
def test_noProject(self):
req = self.req_d
diff --git a/utils/test/result_collection_api/tests/unit/test_testcase.py b/utils/test/result_collection_api/tests/unit/test_testcase.py
index c6c060802..237147205 100644
--- a/utils/test/result_collection_api/tests/unit/test_testcase.py
+++ b/utils/test/result_collection_api/tests/unit/test_testcase.py
@@ -85,13 +85,13 @@ class TestCaseCreate(TestCaseBase):
req_empty = TestcaseCreateRequest('')
(code, body) = self.create(req_empty, self.project)
self.assertEqual(code, HTTP_BAD_REQUEST)
- self.assertIn('testcase name missing', body)
+ self.assertIn('name missing', body)
def test_noneName(self):
req_none = TestcaseCreateRequest(None)
(code, body) = self.create(req_none, self.project)
self.assertEqual(code, HTTP_BAD_REQUEST)
- self.assertIn('testcase name missing', body)
+ self.assertIn('name missing', body)
def test_success(self):
code, body = self.create_d()