Skip to content

Commit

Permalink
revisions and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
AAfghahi committed Jun 22, 2021
1 parent aa22011 commit 4ccac81
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
</div>
);

const handleBackButton = () => {
const handleBackButtonOnFinish = () => {
if (dbFetched) {
fetchResource(dbFetched.id as number);
}
Expand Down Expand Up @@ -576,7 +576,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({

return (
<>
<StyledFooterButton key="back" onClick={handleBackButton}>
<StyledFooterButton key="back" onClick={handleBackButtonOnFinish}>
Back
</StyledFooterButton>
<StyledFooterButton
Expand Down Expand Up @@ -635,7 +635,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
setTabKey(key);
};

const renderExtraOptions = () => {
const renderFinishState = () => {
if (!editNewDb) {
return (
<ExtraOptions
Expand Down Expand Up @@ -893,7 +893,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
dbModel={dbModel}
editNewDb={editNewDb}
/>
{renderExtraOptions()}
{renderFinishState()}
</>
) : (
<>
Expand Down
2 changes: 1 addition & 1 deletion superset/db_engine_specs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]},
Expand Down
18 changes: 16 additions & 2 deletions tests/databases/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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.",
}
],
},
},
]
}

Expand Down

0 comments on commit 4ccac81

Please sign in to comment.