Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix api_test and typeScript error #15202

Merged
merged 12 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed typescript error, made test better
  • Loading branch information
AAfghahi committed Jun 16, 2021
commit a95c06e5565f37b208bf06a37f69588ed4b74784
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
97 changes: 31 additions & 66 deletions tests/databases/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1675,74 +1675,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