mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: show error on invalid import (#14851)
* fix: show error on invalid import * Add unit test * Remove unused imports * Fix tests
This commit is contained in:
@@ -1633,9 +1633,22 @@ class TestChartApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixin):
|
||||
|
||||
assert rv.status_code == 422
|
||||
assert response == {
|
||||
"message": {
|
||||
"charts/imported_chart.yaml": "Chart already exists and `overwrite=true` was not passed"
|
||||
}
|
||||
"errors": [
|
||||
{
|
||||
"message": "Error importing chart",
|
||||
"error_type": "GENERIC_COMMAND_ERROR",
|
||||
"level": "warning",
|
||||
"extra": {
|
||||
"charts/imported_chart.yaml": "Chart already exists and `overwrite=true` was not passed",
|
||||
"issue_codes": [
|
||||
{
|
||||
"code": 1010,
|
||||
"message": "Issue 1010 - Superset encountered an error while running a command.",
|
||||
}
|
||||
],
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
# import with overwrite flag
|
||||
@@ -1691,7 +1704,25 @@ class TestChartApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixin):
|
||||
|
||||
assert rv.status_code == 422
|
||||
assert response == {
|
||||
"message": {"metadata.yaml": {"type": ["Must be equal to Slice."]}}
|
||||
"errors": [
|
||||
{
|
||||
"message": "Error importing chart",
|
||||
"error_type": "GENERIC_COMMAND_ERROR",
|
||||
"level": "warning",
|
||||
"extra": {
|
||||
"metadata.yaml": {"type": ["Must be equal to Slice."]},
|
||||
"issue_codes": [
|
||||
{
|
||||
"code": 1010,
|
||||
"message": (
|
||||
"Issue 1010 - Superset encountered an "
|
||||
"error while running a command."
|
||||
),
|
||||
}
|
||||
],
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
|
||||
Reference in New Issue
Block a user