summaryrefslogtreecommitdiffstats
path: root/utils/test/testapi/opnfv_testapi/tests/unit/test_token.py
diff options
context:
space:
mode:
authorSerena Feng <feng.xiaowei@zte.com.cn>2017-04-10 01:08:48 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-04-10 01:08:48 +0000
commit132fecf179dfcbaa7a39eabee0a65762600077d1 (patch)
tree317900e72986127ba7db0f8f2bb73093a785782f /utils/test/testapi/opnfv_testapi/tests/unit/test_token.py
parent6c30e78d5a3fa013b544833167b0822e79d5a53f (diff)
parentaa823fd3bbe42ead475217e2a5b947a636cf63dd (diff)
Merge "unify error message in TestAPI"
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/tests/unit/test_token.py')
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_token.py13
1 files changed, 7 insertions, 6 deletions
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 9cc52a2f0..ed3eda0f7 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_token.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_token.py
@@ -9,6 +9,7 @@ import unittest
from tornado import web
import fake_pymongo
+from opnfv_testapi.common import message
from opnfv_testapi.resources import project_models
from opnfv_testapi.router import url_mappings
import test_base as base
@@ -35,13 +36,13 @@ class TestTokenCreateProject(TestToken):
self.headers['X-Auth-Token'] = '1234'
code, body = self.create_d()
self.assertEqual(code, httplib.FORBIDDEN)
- self.assertIn('Invalid Token.', body)
+ self.assertIn(message.invalid_token(), body)
def test_projectCreateTokenUnauthorized(self):
self.headers.pop('X-Auth-Token')
code, body = self.create_d()
self.assertEqual(code, httplib.UNAUTHORIZED)
- self.assertIn('No Authentication Header.', body)
+ self.assertIn(message.unauthorized(), body)
def test_projectCreateTokenSuccess(self):
self.headers['X-Auth-Token'] = '12345'
@@ -62,7 +63,7 @@ class TestTokenDeleteProject(TestToken):
self.headers['X-Auth-Token'] = '1234'
code, body = self.delete(self.req_d.name)
self.assertEqual(code, httplib.FORBIDDEN)
- self.assertIn('Invalid Token.', body)
+ self.assertIn(message.invalid_token(), body)
def test_projectDeleteTokenUnauthorized(self):
self.headers['X-Auth-Token'] = '12345'
@@ -70,7 +71,7 @@ class TestTokenDeleteProject(TestToken):
self.headers.pop('X-Auth-Token')
code, body = self.delete(self.req_d.name)
self.assertEqual(code, httplib.UNAUTHORIZED)
- self.assertIn('No Authentication Header.', body)
+ self.assertIn(message.unauthorized(), body)
def test_projectDeleteTokenSuccess(self):
self.headers['X-Auth-Token'] = '12345'
@@ -94,7 +95,7 @@ class TestTokenUpdateProject(TestToken):
req = project_models.ProjectUpdateRequest('newName', 'new description')
code, body = self.update(req, self.req_d.name)
self.assertEqual(code, httplib.FORBIDDEN)
- self.assertIn('Invalid Token.', body)
+ self.assertIn(message.invalid_token(), body)
def test_projectUpdateTokenUnauthorized(self):
self.headers['X-Auth-Token'] = '12345'
@@ -104,7 +105,7 @@ class TestTokenUpdateProject(TestToken):
req = project_models.ProjectUpdateRequest('newName', 'new description')
code, body = self.update(req, self.req_d.name)
self.assertEqual(code, httplib.UNAUTHORIZED)
- self.assertIn('No Authentication Header.', body)
+ self.assertIn(message.unauthorized(), body)
def test_projectUpdateTokenSuccess(self):
self.headers['X-Auth-Token'] = '12345'