From c05e2986e658d9892c9d65203a1e2a785c68bf27 Mon Sep 17 00:00:00 2001 From: Stamatis Katsaounis Date: Thu, 4 Oct 2018 12:42:16 +0300 Subject: Revive unit tests and flake8 of webportal JIRA: DOVETAIL-742 This patch revives unit test and flake8 tests of webportal. In addition, it fixes errors and enables handling of some uris which were forgotten. Change-Id: I8225c7ca08a3c97b6e77f00490defc91046a2dd6 Signed-off-by: Stamatis Katsaounis --- opnfv_testapi/resources/handlers.py | 4 ++-- opnfv_testapi/resources/models.py | 4 ++-- opnfv_testapi/resources/result_handlers.py | 2 +- opnfv_testapi/resources/scenario_handlers.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'opnfv_testapi/resources') diff --git a/opnfv_testapi/resources/handlers.py b/opnfv_testapi/resources/handlers.py index 9b156e1..e8c81f3 100644 --- a/opnfv_testapi/resources/handlers.py +++ b/opnfv_testapi/resources/handlers.py @@ -55,7 +55,7 @@ class GenericApiHandler(web.RequestHandler): def get_int(self, key, value): try: value = int(value) - except: + except Exception: raises.BadRequest(message.must_int(key)) return value @@ -327,5 +327,5 @@ class VersionHandler(GenericApiHandler): @description: list all supported versions @rtype: L{Versions} """ - versions = [{'version': 'api.cvp.0.7.0', 'description': 'basics'}] + versions = [{'version': 'v1.0', 'description': 'basics'}] self.finish_request({'versions': versions}) diff --git a/opnfv_testapi/resources/models.py b/opnfv_testapi/resources/models.py index e8fc532..06db995 100644 --- a/opnfv_testapi/resources/models.py +++ b/opnfv_testapi/resources/models.py @@ -68,10 +68,10 @@ class ModelBase(object): elif isinstance(obj, unicode): try: obj = self._obj_format(ast.literal_eval(obj)) - except: + except Exception: try: obj = str(obj) - except: + except Exception: obj = obj elif isinstance(obj, list): hs = list() diff --git a/opnfv_testapi/resources/result_handlers.py b/opnfv_testapi/resources/result_handlers.py index b7b5c2b..b8d166c 100644 --- a/opnfv_testapi/resources/result_handlers.py +++ b/opnfv_testapi/resources/result_handlers.py @@ -37,7 +37,7 @@ class GenericResultHandler(handlers.GenericApiHandler): def get_int(self, key, value): try: value = int(value) - except: + except Exception: raises.BadRequest(message.must_int(key)) return value diff --git a/opnfv_testapi/resources/scenario_handlers.py b/opnfv_testapi/resources/scenario_handlers.py index 5d420a5..0aa6063 100644 --- a/opnfv_testapi/resources/scenario_handlers.py +++ b/opnfv_testapi/resources/scenario_handlers.py @@ -16,7 +16,7 @@ class GenericScenarioHandler(handlers.GenericApiHandler): self.table_cls = models.Scenario -class ScenariosCLHandler(GenericScenarioHandler): +class ScenarioCLHandler(GenericScenarioHandler): @swagger.operation(nickname="queryScenarios") def get(self): """ -- cgit 1.2.3-korg