From e2bbce72ca32d3bfdde04149b9d702b0a82d3279 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Sat, 24 Feb 2018 16:46:51 +0800 Subject: set debug=False to prevent useless tracebacks Change-Id: Ide0e00e3aa6ee4a484fd9d1b7c9bc52b598267ea Signed-off-by: SerenaFeng --- testapi/etc/config.ini | 2 +- testapi/opnfv_testapi/handlers/result_handlers.py | 2 ++ testapi/opnfv_testapi/tests/unit/common/test_config.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'testapi') diff --git a/testapi/etc/config.ini b/testapi/etc/config.ini index 86cb0ca..5f568a7 100644 --- a/testapi/etc/config.ini +++ b/testapi/etc/config.ini @@ -15,7 +15,7 @@ port = 8000 results_per_page = 20 # With debug_on set to true, error traces will be shown in HTTP responses -debug = True +debug = False token_check = False authenticate = True diff --git a/testapi/opnfv_testapi/handlers/result_handlers.py b/testapi/opnfv_testapi/handlers/result_handlers.py index b0691cd..2d4280f 100644 --- a/testapi/opnfv_testapi/handlers/result_handlers.py +++ b/testapi/opnfv_testapi/handlers/result_handlers.py @@ -245,6 +245,8 @@ class ResultsUploadHandler(ResultsCLHandler): @raise 400: body/pod_name/project_name/case_name not provided """ logging.info('file upload') + if not self.request.files: + raises.NotFound(message.key_error('file')) fileinfo = self.request.files['file'][0] is_public = self.get_body_argument('public') logging.warning('public:%s', is_public) diff --git a/testapi/opnfv_testapi/tests/unit/common/test_config.py b/testapi/opnfv_testapi/tests/unit/common/test_config.py index 6d160ce..8e4966f 100644 --- a/testapi/opnfv_testapi/tests/unit/common/test_config.py +++ b/testapi/opnfv_testapi/tests/unit/common/test_config.py @@ -11,7 +11,7 @@ def test_config_normal(mocker, config_normal): assert CONF.mongo_url == 'mongodb://127.0.0.1:27017/' assert CONF.mongo_dbname == 'test_results_collection' assert CONF.api_port == 8000 - assert CONF.api_debug is True + assert CONF.api_debug is False assert CONF.api_token_check is False assert CONF.api_authenticate is True assert CONF.ui_url == 'http://localhost:8000' -- cgit 1.2.3-korg