From a55651eb098da2e1aa90c93294a59857711b48c1 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Wed, 1 Jun 2016 15:36:17 +0800 Subject: project-ize testAPI JIRA: FUNCTEST-284 Change-Id: I219e934bb11f50de84df2aa0345ecc7885223491 Signed-off-by: SerenaFeng --- .../tests/unit/test_dashboard.py | 71 ---------------------- 1 file changed, 71 deletions(-) delete mode 100644 utils/test/result_collection_api/tests/unit/test_dashboard.py (limited to 'utils/test/result_collection_api/tests/unit/test_dashboard.py') diff --git a/utils/test/result_collection_api/tests/unit/test_dashboard.py b/utils/test/result_collection_api/tests/unit/test_dashboard.py deleted file mode 100644 index 5c3f92492..000000000 --- a/utils/test/result_collection_api/tests/unit/test_dashboard.py +++ /dev/null @@ -1,71 +0,0 @@ -import unittest - -from test_result import TestResultBase -from common.constants import HTTP_NOT_FOUND, HTTP_OK - -__author__ = '__serena__' - - -class TestDashboardBase(TestResultBase): - def setUp(self): - super(TestDashboardBase, self).setUp() - self.basePath = '/dashboard/v1/results' - self.create_help('/api/v1/results', self.req_d) - self.create_help('/api/v1/results', self.req_d) - self.list_res = None - - -class TestDashboardQuery(TestDashboardBase): - def test_projectMissing(self): - code, body = self.query(self._set_query(project='missing')) - self.assertEqual(code, HTTP_NOT_FOUND) - self.assertIn('Project name missing', body) - - def test_projectNotReady(self): - code, body = self.query(self._set_query(project='notReadyProject')) - self.assertEqual(code, HTTP_NOT_FOUND) - self.assertIn('Project [notReadyProject] not dashboard ready', body) - - def test_testcaseMissing(self): - code, body = self.query(self._set_query(case='missing')) - self.assertEqual(code, HTTP_NOT_FOUND) - self.assertIn('Test case missing for project [{}]' - .format(self.project), - body) - - def test_testcaseNotReady(self): - code, body = self.query(self._set_query(case='notReadyCase')) - self.assertEqual(code, HTTP_NOT_FOUND) - self.assertIn( - 'Test case [notReadyCase] not dashboard ready for project [%s]' - % self.project, - body) - - def test_success(self): - code, body = self.query(self._set_query()) - self.assertEqual(code, HTTP_OK) - self.assertIn('{"description": "vPing results for Dashboard"}', body) - - def test_caseIsStatus(self): - code, body = self.query(self._set_query(case='status')) - self.assertEqual(code, HTTP_OK) - self.assertIn('{"description": "Functest status"}', body) - - def _set_query(self, project=None, case=None): - uri = '' - for k, v in list(locals().iteritems()): - if k == 'self' or k == 'uri': - continue - if v is None: - v = eval('self.' + k) - if v != 'missing': - uri += '{}={}&'.format(k, v) - uri += 'pod={}&'.format(self.pod) - uri += 'version={}&'.format(self.version) - uri += 'installer={}&'.format(self.installer) - uri += 'period={}&'.format(5) - return uri[0:-1] - - -if __name__ == '__main__': - unittest.main() -- cgit 1.2.3-korg