From 4ccac8126624b149cc089c2e2766ab6e7b84ece2 Mon Sep 17 00:00:00 2001 From: Arash Date: Tue, 22 Jun 2021 12:45:39 -0400 Subject: [PATCH] revisions and testing --- .../CRUD/data/database/DatabaseModal/index.tsx | 8 ++++---- superset/db_engine_specs/base.py | 2 +- tests/databases/api_tests.py | 18 ++++++++++++++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx index 0bb37a9de9873..ac3ed886d600d 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -542,7 +542,7 @@ const DatabaseModal: FunctionComponent = ({ ); - const handleBackButton = () => { + const handleBackButtonOnFinish = () => { if (dbFetched) { fetchResource(dbFetched.id as number); } @@ -576,7 +576,7 @@ const DatabaseModal: FunctionComponent = ({ return ( <> - + Back = ({ setTabKey(key); }; - const renderExtraOptions = () => { + const renderFinishState = () => { if (!editNewDb) { return ( = ({ dbModel={dbModel} editNewDb={editNewDb} /> - {renderExtraOptions()} + {renderFinishState()} ) : ( <> diff --git a/superset/db_engine_specs/base.py b/superset/db_engine_specs/base.py index c93419ec49e59..943ebc42b73db 100644 --- a/superset/db_engine_specs/base.py +++ b/superset/db_engine_specs/base.py @@ -1450,7 +1450,7 @@ def validate_parameters( except (ValueError, TypeError): errors.append( SupersetError( - message="Port must be a valid integer", + message="Port must be a valid integer.", error_type=SupersetErrorType.CONNECTION_INVALID_PORT_ERROR, level=ErrorLevel.ERROR, extra={"invalid": ["port"]}, diff --git a/tests/databases/api_tests.py b/tests/databases/api_tests.py index d091264d7ea66..0dfbf322b0991 100644 --- a/tests/databases/api_tests.py +++ b/tests/databases/api_tests.py @@ -1807,7 +1807,9 @@ def test_validate_parameters_invalid_port(self): assert response == { "errors": [ { + "message": "Port must be a valid integer.", "error_type": "CONNECTION_INVALID_PORT_ERROR", + "level": "error", "extra": { "invalid": ["port"], "issue_codes": [ @@ -1817,9 +1819,21 @@ def test_validate_parameters_invalid_port(self): } ], }, - "level": "error", + }, + { + "error_type": "CONNECTION_INVALID_PORT_ERROR", "message": "The port must be an integer between 0 and 65535 (inclusive).", - } + "level": "error", + "extra": { + "invalid": ["port"], + "issue_codes": [ + { + "code": 1021, + "message": "Issue 1021 - Port number is invalid.", + } + ], + }, + }, ] }