summaryrefslogtreecommitdiffstats
path: root/utils/test/testapi/opnfv_testapi/tests
diff options
context:
space:
mode:
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/tests')
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py14
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_project.py32
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_result.py30
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py30
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py36
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_token.py20
6 files changed, 81 insertions, 81 deletions
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py
index 922bd46e2..cec90d8a5 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py
@@ -6,9 +6,9 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import httplib
import unittest
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import pod_models
import test_base as base
@@ -37,36 +37,36 @@ class TestPodBase(base.TestBase):
class TestPodCreate(TestPodBase):
def test_withoutBody(self):
(code, body) = self.create()
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_emptyName(self):
req_empty = pod_models.PodCreateRequest('')
(code, body) = self.create(req_empty)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_noneName(self):
req_none = pod_models.PodCreateRequest(None)
(code, body) = self.create(req_none)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_success(self):
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_create_body(body)
def test_alreadyExist(self):
self.create_d()
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('already exists', body)
class TestPodGet(TestPodBase):
def test_notExist(self):
code, body = self.get('notExist')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_getOne(self):
self.create_d()
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_project.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_project.py
index afd4a6601..75b2d5260 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_project.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_project.py
@@ -6,9 +6,9 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import httplib
import unittest
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import project_models
import test_base as base
@@ -37,41 +37,41 @@ class TestProjectBase(base.TestBase):
class TestProjectCreate(TestProjectBase):
def test_withoutBody(self):
(code, body) = self.create()
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_emptyName(self):
req_empty = project_models.ProjectCreateRequest('')
(code, body) = self.create(req_empty)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_noneName(self):
req_none = project_models.ProjectCreateRequest(None)
(code, body) = self.create(req_none)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_success(self):
(code, body) = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_create_body(body)
def test_alreadyExist(self):
self.create_d()
(code, body) = self.create_d()
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('already exists', body)
class TestProjectGet(TestProjectBase):
def test_notExist(self):
code, body = self.get('notExist')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_getOne(self):
self.create_d()
code, body = self.get(self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_body(body)
def test_list(self):
@@ -88,23 +88,23 @@ class TestProjectGet(TestProjectBase):
class TestProjectUpdate(TestProjectBase):
def test_withoutBody(self):
code, _ = self.update(None, 'noBody')
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_notFound(self):
code, _ = self.update(self.req_e, 'notFound')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_newNameExist(self):
self.create_d()
self.create_e()
code, body = self.update(self.req_e, self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn("already exists", body)
def test_noUpdate(self):
self.create_d()
code, body = self.update(self.req_d, self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn("Nothing to update", body)
def test_success(self):
@@ -114,7 +114,7 @@ class TestProjectUpdate(TestProjectBase):
req = project_models.ProjectUpdateRequest('newName', 'new description')
code, body = self.update(req, self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(_id, body._id)
self.assert_body(body, req)
@@ -126,16 +126,16 @@ class TestProjectUpdate(TestProjectBase):
class TestProjectDelete(TestProjectBase):
def test_notFound(self):
code, body = self.delete('notFound')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_success(self):
self.create_d()
code, body = self.delete(self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(body, '')
code, body = self.get(self.req_d.name)
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
if __name__ == '__main__':
unittest.main()
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py
index 2c7268eb6..05220f1d2 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py
@@ -8,9 +8,9 @@
##############################################################################
import copy
from datetime import datetime, timedelta
+import httplib
import unittest
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import pod_models
from opnfv_testapi.resources import project_models
from opnfv_testapi.resources import result_models
@@ -99,7 +99,7 @@ class TestResultBase(base.TestBase):
self.project)
def assert_res(self, code, result, req=None):
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
if req is None:
req = self.req_d
self.assertEqual(result.pod_name, req.pod_name)
@@ -134,61 +134,61 @@ class TestResultBase(base.TestBase):
class TestResultCreate(TestResultBase):
def test_nobody(self):
(code, body) = self.create(None)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
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, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
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, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
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, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
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, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
self.assertIn('Could not find pod', body)
def test_noProject(self):
req = self.req_d
req.project_name = 'notExistProject'
(code, body) = self.create(req)
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
self.assertIn('Could not find project', body)
def test_noTestcase(self):
req = self.req_d
req.case_name = 'notExistTestcase'
(code, body) = self.create(req)
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
self.assertIn('Could not find testcase', body)
def test_success(self):
(code, body) = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_href(body)
def test_key_with_doc(self):
req = copy.deepcopy(self.req_d)
req.details = {'1.name': 'dot_name'}
(code, body) = self.create(req)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_href(body)
def test_no_ti(self):
@@ -205,7 +205,7 @@ class TestResultCreate(TestResultBase):
criteria=self.criteria)
(code, res) = self.create(req)
_id = res.href.split('/')[-1]
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
code, body = self.get(_id)
self.assert_res(code, body, req)
@@ -245,7 +245,7 @@ class TestResultGet(TestResultBase):
def test_queryPeriodNotInt(self):
code, body = self.query(self._set_query('period=a'))
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('period must be int', body)
def test_queryPeriodFail(self):
@@ -258,7 +258,7 @@ class TestResultGet(TestResultBase):
def test_queryLastNotInt(self):
code, body = self.query(self._set_query('last=a'))
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('last must be int', body)
def test_queryLast(self):
@@ -297,7 +297,7 @@ class TestResultGet(TestResultBase):
req = self._create_changed_date(**kwargs)
code, body = self.query(query)
if not found:
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(0, len(body.results))
else:
self.assertEqual(1, len(body.results))
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py
index b62c1d294..ab2c34b31 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py
@@ -1,10 +1,10 @@
from copy import deepcopy
from datetime import datetime
import functools
+import httplib
import json
import os
-from opnfv_testapi.common import constants
import opnfv_testapi.resources.scenario_models as models
import test_base as base
@@ -37,7 +37,7 @@ class TestScenarioBase(base.TestBase):
return res.href.split('/')[-1]
def assert_res(self, code, scenario, req=None):
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
if req is None:
req = self.req_d
self.assertIsNotNone(scenario._id)
@@ -60,29 +60,29 @@ class TestScenarioBase(base.TestBase):
class TestScenarioCreate(TestScenarioBase):
def test_withoutBody(self):
(code, body) = self.create()
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_emptyName(self):
req_empty = models.ScenarioCreateRequest('')
(code, body) = self.create(req_empty)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_noneName(self):
req_none = models.ScenarioCreateRequest(None)
(code, body) = self.create(req_none)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_success(self):
(code, body) = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_create_body(body)
def test_alreadyExist(self):
self.create_d()
(code, body) = self.create_d()
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('already exists', body)
@@ -125,7 +125,7 @@ class TestScenarioGet(TestScenarioBase):
def _query_and_assert(self, query, found=True, reqs=None):
code, body = self.query(query)
if not found:
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(0, len(body.scenarios))
else:
self.assertEqual(len(reqs), len(body.scenarios))
@@ -327,32 +327,32 @@ class TestScenarioUpdate(TestScenarioBase):
def _update_and_assert(self, update_req, new_scenario, name=None):
code, _ = self.update(update_req, self.scenario)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self._get_and_assert(_none_default(name, self.scenario),
new_scenario)
def _success(self, status, new_scenario):
- self.assertEqual(status, constants.HTTP_OK)
+ self.assertEqual(status, httplib.OK)
self._get_and_assert(new_scenario.get('name'), new_scenario)
def _forbidden(self, status, new_scenario):
- self.assertEqual(status, constants.HTTP_FORBIDDEN)
+ self.assertEqual(status, httplib.FORBIDDEN)
def _bad_request(self, status, new_scenario):
- self.assertEqual(status, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(status, httplib.BAD_REQUEST)
class TestScenarioDelete(TestScenarioBase):
def test_notFound(self):
code, body = self.delete('notFound')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_success(self):
scenario = self.create_return_name(self.req_d)
code, _ = self.delete(scenario)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
code, _ = self.get(scenario)
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def _none_default(check, default):
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py
index c0494db5d..ec44fcae5 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py
@@ -7,9 +7,9 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import copy
+import httplib
import unittest
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import project_models
from opnfv_testapi.resources import testcase_models
import test_base as base
@@ -79,46 +79,46 @@ class TestCaseBase(base.TestBase):
class TestCaseCreate(TestCaseBase):
def test_noBody(self):
(code, body) = self.create(None, 'vping')
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_noProject(self):
code, body = self.create(self.req_d, 'noProject')
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('Could not find project', body)
def test_emptyName(self):
req_empty = testcase_models.TestcaseCreateRequest('')
(code, body) = self.create(req_empty, self.project)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_noneName(self):
req_none = testcase_models.TestcaseCreateRequest(None)
(code, body) = self.create(req_none, self.project)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_success(self):
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_create_body(body, None, self.project)
def test_alreadyExist(self):
self.create_d()
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('already exists', body)
class TestCaseGet(TestCaseBase):
def test_notExist(self):
code, body = self.get('notExist')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_getOne(self):
self.create_d()
code, body = self.get(self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_body(body)
def test_list(self):
@@ -135,23 +135,23 @@ class TestCaseGet(TestCaseBase):
class TestCaseUpdate(TestCaseBase):
def test_noBody(self):
code, _ = self.update(case='noBody')
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_notFound(self):
code, _ = self.update(self.update_e, 'notFound')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_newNameExist(self):
self.create_d()
self.create_e()
code, body = self.update(self.update_e, self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn("already exists", body)
def test_noUpdate(self):
self.create_d()
code, body = self.update(self.update_d, self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn("Nothing to update", body)
def test_success(self):
@@ -160,7 +160,7 @@ class TestCaseUpdate(TestCaseBase):
_id = body._id
code, body = self.update(self.update_e, self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(_id, body._id)
self.assert_update_body(self.req_d, body, self.update_e)
@@ -173,22 +173,22 @@ class TestCaseUpdate(TestCaseBase):
update = copy.deepcopy(self.update_d)
update.description = {'2. change': 'dollar change'}
code, body = self.update(update, self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
class TestCaseDelete(TestCaseBase):
def test_notFound(self):
code, body = self.delete('notFound')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_success(self):
self.create_d()
code, body = self.delete(self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(body, '')
code, body = self.get(self.req_d.name)
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
if __name__ == '__main__':
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_token.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_token.py
index 19b9e3e07..9cc52a2f0 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_token.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_token.py
@@ -3,12 +3,12 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
+import httplib
import unittest
from tornado import web
import fake_pymongo
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import project_models
from opnfv_testapi.router import url_mappings
import test_base as base
@@ -34,19 +34,19 @@ class TestTokenCreateProject(TestToken):
def test_projectCreateTokenInvalid(self):
self.headers['X-Auth-Token'] = '1234'
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('Invalid Token.', body)
def test_projectCreateTokenUnauthorized(self):
self.headers.pop('X-Auth-Token')
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_UNAUTHORIZED)
+ self.assertEqual(code, httplib.UNAUTHORIZED)
self.assertIn('No Authentication Header.', body)
def test_projectCreateTokenSuccess(self):
self.headers['X-Auth-Token'] = '12345'
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
class TestTokenDeleteProject(TestToken):
@@ -61,7 +61,7 @@ class TestTokenDeleteProject(TestToken):
self.create_d()
self.headers['X-Auth-Token'] = '1234'
code, body = self.delete(self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('Invalid Token.', body)
def test_projectDeleteTokenUnauthorized(self):
@@ -69,14 +69,14 @@ class TestTokenDeleteProject(TestToken):
self.create_d()
self.headers.pop('X-Auth-Token')
code, body = self.delete(self.req_d.name)
- self.assertEqual(code, constants.HTTP_UNAUTHORIZED)
+ self.assertEqual(code, httplib.UNAUTHORIZED)
self.assertIn('No Authentication Header.', body)
def test_projectDeleteTokenSuccess(self):
self.headers['X-Auth-Token'] = '12345'
self.create_d()
code, body = self.delete(self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
class TestTokenUpdateProject(TestToken):
@@ -93,7 +93,7 @@ class TestTokenUpdateProject(TestToken):
self.headers['X-Auth-Token'] = '1234'
req = project_models.ProjectUpdateRequest('newName', 'new description')
code, body = self.update(req, self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('Invalid Token.', body)
def test_projectUpdateTokenUnauthorized(self):
@@ -103,7 +103,7 @@ class TestTokenUpdateProject(TestToken):
self.headers.pop('X-Auth-Token')
req = project_models.ProjectUpdateRequest('newName', 'new description')
code, body = self.update(req, self.req_d.name)
- self.assertEqual(code, constants.HTTP_UNAUTHORIZED)
+ self.assertEqual(code, httplib.UNAUTHORIZED)
self.assertIn('No Authentication Header.', body)
def test_projectUpdateTokenSuccess(self):
@@ -112,7 +112,7 @@ class TestTokenUpdateProject(TestToken):
code, body = self.get(self.req_d.name)
req = project_models.ProjectUpdateRequest('newName', 'new description')
code, body = self.update(req, self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
if __name__ == '__main__':
unittest.main()