X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=utils%2Ftest%2Ftestapi%2Fopnfv_testapi%2Fresources%2Fpod_handlers.py;h=502988752bb6f41a65711a5f2dafe1416f3c04d4;hb=c0de44528cb8fdfb7d29158909a589db3628d889;hp=65c27f60a09d2c6852f23c10cbcf8de449592213;hpb=2b72e01a433d886999f2159e996a65fb7d855706;p=releng.git diff --git a/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py b/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py index 65c27f60a..502988752 100644 --- a/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py @@ -7,9 +7,8 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## import handlers -from opnfv_testapi.common import constants +from opnfv_testapi.resources import pod_models from opnfv_testapi.tornado_swagger import swagger -import pod_models class GenericPodHandler(handlers.GenericApiHandler): @@ -41,16 +40,10 @@ class PodCLHandler(GenericPodHandler): @raise 403: pod already exists @raise 400: body or name not provided """ - def query(data): - return {'name': data.name} - - def error(data): - message = '{} already exists as a pod'.format(data.name) - return constants.HTTP_FORBIDDEN, message - - miss_checks = ['name'] - db_checks = [(self.table, False, query, error)] - self._create(miss_checks, db_checks) + def query(): + return {'name': self.json_args.get('name')} + miss_fields = ['name'] + self._create(miss_fields=miss_fields, query=query) class PodGURHandler(GenericPodHandler): @@ -62,9 +55,7 @@ class PodGURHandler(GenericPodHandler): @return 200: pod exist @raise 404: pod not exist """ - query = dict() - query['name'] = pod_name - self._get_one(query) + self._get_one(query={'name': pod_name}) def delete(self, pod_name): """ Remove a POD