Skip to content

Commit

Permalink
fix: fix api_test and typeScript error (#15202)
Browse files Browse the repository at this point in the history
  • Loading branch information
AAfghahi authored Jun 16, 2021
1 parent 7b4ae58 commit 52f9658
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function dbReducer(

if (action.payload?.parameters?.credentials_info) {
// deserialize credentials info for big query editting
action.payload.parameters.credentials_info = JSON.stringify(
deserializeExtraJSON = JSON.stringify(
action.payload?.parameters.credentials_info,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ export const antDModalStyles = (theme: SupersetTheme) => css`
export const antDAlertStyles = (theme: SupersetTheme) => css`
border: 1px solid ${theme.colors.info.base};
padding: ${theme.gridUnit * 4}px;
margin: ${theme.gridUnit * 8}px 0
${theme.gridUnit * 4}px;
margin: ${theme.gridUnit * 8}px 0 ${theme.gridUnit * 4}px;
.ant-alert-message {
color: ${theme.colors.info.dark2};
font-size: ${theme.typography.sizes.s + 1}px;
Expand Down
98 changes: 31 additions & 67 deletions tests/databases/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,6 @@ def test_available(self, app, get_available_engine_specs):
"x-encrypted-extra": True,
}
},
"required": ["credentials_info"],
"type": "object",
},
"preferred": True,
Expand Down Expand Up @@ -1675,74 +1674,39 @@ def test_validate_parameters_invalid_payload_schema(self):
response = json.loads(rv.data.decode("utf-8"))

assert rv.status_code == 422
invalid_schema = response["errors"][0]["extra"]["invalid"][0]
# This is done because this array of errors does not have a deterministic order
if invalid_schema == "engine":
assert response == {
"errors": [
{
"message": "Missing data for required field.",
"error_type": "INVALID_PAYLOAD_SCHEMA_ERROR",
"level": "error",
"extra": {
"invalid": ["engine"],
"issue_codes": [
{
"code": 1020,
"message": "Issue 1020 - The submitted payload has the incorrect schema.",
}
],
},
},
{
"message": "Missing data for required field.",
"error_type": "INVALID_PAYLOAD_SCHEMA_ERROR",
"level": "error",
"extra": {
"invalid": ["configuration_method"],
"issue_codes": [
{
"code": 1020,
"message": "Issue 1020 - The submitted payload has the incorrect schema.",
}
],
},
},
]
}
else:
assert response == {
"errors": [
{
"message": "Missing data for required field.",
"error_type": "INVALID_PAYLOAD_SCHEMA_ERROR",
"level": "error",
"extra": {
"invalid": ["configuration_method"],
"issue_codes": [
{
"code": 1020,
"message": "Issue 1020 - The submitted payload has the incorrect schema.",
}
],
},
response["errors"].sort(key=lambda error: error["extra"]["invalid"][0])
assert response == {
"errors": [
{
"message": "Missing data for required field.",
"error_type": "INVALID_PAYLOAD_SCHEMA_ERROR",
"level": "error",
"extra": {
"invalid": ["configuration_method"],
"issue_codes": [
{
"code": 1020,
"message": "Issue 1020 - The submitted payload has the incorrect schema.",
}
],
},
{
"message": "Missing data for required field.",
"error_type": "INVALID_PAYLOAD_SCHEMA_ERROR",
"level": "error",
"extra": {
"invalid": ["engine"],
"issue_codes": [
{
"code": 1020,
"message": "Issue 1020 - The submitted payload has the incorrect schema.",
}
],
},
},
{
"message": "Missing data for required field.",
"error_type": "INVALID_PAYLOAD_SCHEMA_ERROR",
"level": "error",
"extra": {
"invalid": ["engine"],
"issue_codes": [
{
"code": 1020,
"message": "Issue 1020 - The submitted payload has the incorrect schema.",
}
],
},
]
}
},
]
}

def test_validate_parameters_missing_fields(self):
self.login(username="admin")
Expand Down

0 comments on commit 52f9658

Please sign in to comment.