X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=utils%2Ftest%2Ftestapi%2Fopnfv_testapi%2Ftests%2Funit%2Ftest_pod.py;h=c2c14149b8228796b26c407747ea11c1406f19de;hb=c12d3a2c298724bf5186c627967430f32a7e33ba;hp=922bd46e2cb1e5cab05b98912f177868e8051ae1;hpb=2b72e01a433d886999f2159e996a65fb7d855706;p=releng.git 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..c2c14149b 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py @@ -6,11 +6,12 @@ # 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.common import message from opnfv_testapi.resources import pod_models -import test_base as base +from opnfv_testapi.tests.unit import test_base as base class TestPodBase(base.TestBase): @@ -37,36 +38,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.assertIn('name missing', body) + self.assertEqual(code, httplib.BAD_REQUEST) + self.assertIn(message.missing('name'), 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.assertIn('name missing', body) + self.assertEqual(code, httplib.BAD_REQUEST) + self.assertIn(message.missing('name'), 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.assertIn('already exists', body) + self.assertEqual(code, httplib.FORBIDDEN) + self.assertIn(message.exist_base, 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()